datastake-daf 0.6.819 → 0.6.821
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/index.js +2264 -1099
- package/dist/hooks/index.js +16 -5
- package/dist/pages/index.js +251 -65
- package/dist/services/index.js +104 -9
- package/dist/utils/index.js +75 -8
- package/package.json +1 -1
- package/src/@daf/core/components/AuthForm/index.jsx +12 -3
- package/src/@daf/core/components/DynamicForm/_index.scss +1 -3
- package/src/@daf/core/components/EditForm/_index.scss +0 -4
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +27 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +2 -3
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +0 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -3
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/AddAccount/index.jsx +82 -10
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +51 -51
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +6 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +53 -31
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +36 -10
- package/src/@daf/core/components/Screens/Admin/AdminModals/TransferRights/index.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +37 -10
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Documents.jsx +81 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Events.jsx +77 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +2 -1
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +22 -30
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +28 -16
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/column.js +93 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/helper.js +43 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/index.jsx +201 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/column.js +113 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/helper.js +58 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/index.jsx +176 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +3 -6
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +17 -2
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/helper.js +3 -6
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +27 -13
- package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +0 -1
- package/src/@daf/core/components/Screens/Admin/AdminTables/components/index.jsx +4 -2
- package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +3 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +21 -9
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +16 -11
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +16 -4
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/View/helpers.js +9 -17
- package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +12 -16
- package/src/@daf/core/components/Screens/Admin/AppInvitation/index.jsx +124 -99
- package/src/@daf/core/components/Screens/Admin/adminRoutes.js +44 -28
- package/src/@daf/hooks/useAdminDashboard.js +7 -4
- package/src/@daf/hooks/useSources.js +2 -1
- package/src/@daf/pages/Events/columns.js +15 -3
- package/src/@daf/pages/Locations/MineSite/columns.js +18 -1
- package/src/@daf/pages/TablePage/columns.js +2 -0
- package/src/@daf/pages/TablePage/hook.js +0 -2
- package/src/@daf/pages/View/hooks/useViewActions.js +13 -0
- package/src/@daf/pages/View/hooks/useViewPermissions.js +16 -0
- package/src/@daf/pages/View/index.jsx +32 -4
- package/src/@daf/services/AdminService.js +80 -8
- package/src/@daf/services/DashboardService.js +3 -3
- package/src/@daf/utils/filters.js +13 -15
- package/src/constants/locales/en/translation.js +24 -4
- package/src/constants/locales/fr/translation.js +17 -0
- package/src/constants/locales/sp/translation.js +28 -7
- package/src/helpers/copyToClipboard.js +60 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/SubjectsView.jsx +0 -395
- package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/configTransformer.js +0 -137
- package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.js +0 -9
- package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.jsx +0 -196
- package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/configTransformer.js +0 -216
- package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.js +0 -7
- package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.jsx +0 -184
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/config.js +0 -64
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/helpers.js +0 -10
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/index.jsx +0 -77
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/config.js +0 -51
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/helpers.js +0 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/index.jsx +0 -76
package/dist/services/index.js
CHANGED
|
@@ -780,6 +780,20 @@ class AdminService extends BaseService {
|
|
|
780
780
|
data
|
|
781
781
|
});
|
|
782
782
|
}
|
|
783
|
+
resendInvitation({
|
|
784
|
+
invitationToken
|
|
785
|
+
}) {
|
|
786
|
+
return this.apiPost({
|
|
787
|
+
url: `/accounts/resendInvitation/${invitationToken}`
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
copyInvitation({
|
|
791
|
+
invitationToken
|
|
792
|
+
}) {
|
|
793
|
+
return this.apiPost({
|
|
794
|
+
url: `/accounts/copyInvitation/${invitationToken}`
|
|
795
|
+
});
|
|
796
|
+
}
|
|
783
797
|
inviteAccount(data) {
|
|
784
798
|
return this.apiPost({
|
|
785
799
|
url: `/accounts/inviteAccount`,
|
|
@@ -796,8 +810,15 @@ class AdminService extends BaseService {
|
|
|
796
810
|
}
|
|
797
811
|
updateAccount({
|
|
798
812
|
data,
|
|
799
|
-
id
|
|
813
|
+
id,
|
|
814
|
+
isPending = false
|
|
800
815
|
}) {
|
|
816
|
+
if (isPending) {
|
|
817
|
+
return this.apiPut({
|
|
818
|
+
data,
|
|
819
|
+
url: `/accounts/invitation/${id}`
|
|
820
|
+
});
|
|
821
|
+
}
|
|
801
822
|
return this.apiPut({
|
|
802
823
|
data,
|
|
803
824
|
url: `/accounts/${id}`
|
|
@@ -811,11 +832,11 @@ class AdminService extends BaseService {
|
|
|
811
832
|
});
|
|
812
833
|
}
|
|
813
834
|
transferAdmin({
|
|
814
|
-
|
|
815
|
-
|
|
835
|
+
companyId,
|
|
836
|
+
userId
|
|
816
837
|
}) {
|
|
817
838
|
return this.apiPut({
|
|
818
|
-
url: `/
|
|
839
|
+
url: `/companies/${companyId}/transfer-rights`,
|
|
819
840
|
data: {
|
|
820
841
|
userId
|
|
821
842
|
}
|
|
@@ -912,6 +933,58 @@ class AdminService extends BaseService {
|
|
|
912
933
|
url: `/management/subject/${subject}/${id}`
|
|
913
934
|
});
|
|
914
935
|
}
|
|
936
|
+
getItems({
|
|
937
|
+
item
|
|
938
|
+
}) {
|
|
939
|
+
return this.apiGet({
|
|
940
|
+
url: `/management/items/${item}`
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
getItemForm({
|
|
944
|
+
item,
|
|
945
|
+
scope = "create"
|
|
946
|
+
}) {
|
|
947
|
+
return this.apiGet({
|
|
948
|
+
url: `/forms/${item}`,
|
|
949
|
+
params: {
|
|
950
|
+
scope
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
getItemData({
|
|
955
|
+
item,
|
|
956
|
+
id
|
|
957
|
+
}) {
|
|
958
|
+
return this.apiGet({
|
|
959
|
+
url: `/management/item/${item}/${id}`
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
deleteItem({
|
|
963
|
+
item,
|
|
964
|
+
id
|
|
965
|
+
}) {
|
|
966
|
+
return this.apiDelete({
|
|
967
|
+
url: `/management/item/${item}/${id}`
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
updateItem({
|
|
971
|
+
item,
|
|
972
|
+
id,
|
|
973
|
+
data
|
|
974
|
+
}) {
|
|
975
|
+
return this.apiPut({
|
|
976
|
+
url: `/management/item/${item}/${id}`,
|
|
977
|
+
data
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
viewItem({
|
|
981
|
+
item,
|
|
982
|
+
id
|
|
983
|
+
}) {
|
|
984
|
+
return this.apiGet({
|
|
985
|
+
url: `/management/item/${item}/${id}`
|
|
986
|
+
});
|
|
987
|
+
}
|
|
915
988
|
viewLocation({
|
|
916
989
|
id
|
|
917
990
|
}) {
|
|
@@ -934,7 +1007,7 @@ class AdminService extends BaseService {
|
|
|
934
1007
|
const type = subject === 'location' ? 'location' : 'stakeholder';
|
|
935
1008
|
return this.apiPut({
|
|
936
1009
|
url: `/management/subject/${type}/${id}`,
|
|
937
|
-
data:
|
|
1010
|
+
data: data
|
|
938
1011
|
});
|
|
939
1012
|
}
|
|
940
1013
|
deleteSubject({
|
|
@@ -946,14 +1019,33 @@ class AdminService extends BaseService {
|
|
|
946
1019
|
url: `/management/subject/${type}/${id}`
|
|
947
1020
|
});
|
|
948
1021
|
}
|
|
949
|
-
getUserGrowth(activeFilter) {
|
|
950
|
-
|
|
1022
|
+
async getUserGrowth(activeFilter) {
|
|
1023
|
+
const {
|
|
1024
|
+
data
|
|
1025
|
+
} = await this.apiGet({
|
|
951
1026
|
url: `/accounts/dashboard/user-growth`,
|
|
952
1027
|
isUserManager: true,
|
|
953
1028
|
params: {
|
|
954
1029
|
activeFilter
|
|
955
1030
|
}
|
|
956
1031
|
});
|
|
1032
|
+
return data;
|
|
1033
|
+
}
|
|
1034
|
+
removeUserFromAccount({
|
|
1035
|
+
accountId,
|
|
1036
|
+
userId
|
|
1037
|
+
}) {
|
|
1038
|
+
return this.apiPut({
|
|
1039
|
+
url: `/companies/${accountId}/remove-user/${userId}`
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
getTopContributors({
|
|
1043
|
+
params
|
|
1044
|
+
}) {
|
|
1045
|
+
return this.apiGet({
|
|
1046
|
+
url: `/accounts/dashboard/top-contributors`,
|
|
1047
|
+
params
|
|
1048
|
+
});
|
|
957
1049
|
}
|
|
958
1050
|
}
|
|
959
1051
|
var AdminService$1 = createLazyService(AdminService);
|
|
@@ -1405,14 +1497,17 @@ class DashboardService extends BaseService {
|
|
|
1405
1497
|
isApp: true
|
|
1406
1498
|
});
|
|
1407
1499
|
}
|
|
1408
|
-
getUserGrowth(activeFilter) {
|
|
1409
|
-
|
|
1500
|
+
async getUserGrowth(activeFilter) {
|
|
1501
|
+
const {
|
|
1502
|
+
data
|
|
1503
|
+
} = await this.apiGet({
|
|
1410
1504
|
url: `/accounts/dashboard/user-growth`,
|
|
1411
1505
|
isUserManager: true,
|
|
1412
1506
|
params: {
|
|
1413
1507
|
activeFilter
|
|
1414
1508
|
}
|
|
1415
1509
|
});
|
|
1510
|
+
return data;
|
|
1416
1511
|
}
|
|
1417
1512
|
getAdminDashboard() {
|
|
1418
1513
|
return this.apiGet({
|
package/dist/utils/index.js
CHANGED
|
@@ -7592,14 +7592,15 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
|
|
|
7592
7592
|
});
|
|
7593
7593
|
return o;
|
|
7594
7594
|
};
|
|
7595
|
+
const NEW_PAGINATION_APPS = ["nashiriki"];
|
|
7595
7596
|
const filterParams = (value, module) => {
|
|
7596
7597
|
const {
|
|
7597
7598
|
activeFilters,
|
|
7598
7599
|
...rest
|
|
7599
7600
|
} = value;
|
|
7600
7601
|
const {
|
|
7601
|
-
page
|
|
7602
|
-
pageSize
|
|
7602
|
+
page,
|
|
7603
|
+
pageSize,
|
|
7603
7604
|
sortDir,
|
|
7604
7605
|
sortBy,
|
|
7605
7606
|
search,
|
|
@@ -7608,10 +7609,9 @@ const filterParams = (value, module) => {
|
|
|
7608
7609
|
} = activeFilters || {};
|
|
7609
7610
|
const params = {};
|
|
7610
7611
|
params.pagination = JSON.stringify({
|
|
7611
|
-
page,
|
|
7612
|
-
pageSize
|
|
7612
|
+
[NEW_PAGINATION_APPS.includes(module) ? "skip" : "page"]: page,
|
|
7613
|
+
[NEW_PAGINATION_APPS.includes(module) ? "take" : "pageSize"]: pageSize
|
|
7613
7614
|
});
|
|
7614
|
-
params.filters = JSON.stringify(filters);
|
|
7615
7615
|
if (search && searchParams) {
|
|
7616
7616
|
params.search = JSON.stringify({
|
|
7617
7617
|
qs: search,
|
|
@@ -7624,6 +7624,16 @@ const filterParams = (value, module) => {
|
|
|
7624
7624
|
by: sortBy
|
|
7625
7625
|
});
|
|
7626
7626
|
}
|
|
7627
|
+
if (Object.keys(filters).length) {
|
|
7628
|
+
if (value.sourceId && value.sourceId === "overview") {
|
|
7629
|
+
params.filters = JSON.stringify(filters);
|
|
7630
|
+
} else {
|
|
7631
|
+
params.filters = JSON.stringify({
|
|
7632
|
+
...filters,
|
|
7633
|
+
authorId: undefined
|
|
7634
|
+
});
|
|
7635
|
+
}
|
|
7636
|
+
}
|
|
7627
7637
|
return {
|
|
7628
7638
|
...rest,
|
|
7629
7639
|
...params
|
|
@@ -7828,9 +7838,25 @@ function getRedirectPath(user, fallback = '', app, isDatastake) {
|
|
|
7828
7838
|
}
|
|
7829
7839
|
|
|
7830
7840
|
const en = {
|
|
7841
|
+
"admin::events": "Events",
|
|
7842
|
+
"admin::Deleted": "Deleted",
|
|
7843
|
+
"admin::document": "Documents",
|
|
7844
|
+
"events": "Events",
|
|
7845
|
+
"merge-locations": "Merge Locations",
|
|
7846
|
+
"edit-account": "Edit Account",
|
|
7847
|
+
"Are-you-sure-you-want-to-remove-the-user-from-this-account?": "Are you sure you want to remove the user from this account?",
|
|
7848
|
+
"The-user-will-lose-access-to-the-application-and-to-all-data-created-for-this-account.": "The user will lose access to the application and to all data created for this account.",
|
|
7849
|
+
"merge": "Merge",
|
|
7850
|
+
"add-new": "Add new",
|
|
7851
|
+
"sbg-admin::remove-user-body": "The user will lose access to the application and to all data created for this account.",
|
|
7852
|
+
"Are-you-sure-you-want-to-suspend-this-account?": "Are you sure you want to suspend this account?",
|
|
7853
|
+
"Associated-users-will-lose-access-to-the-application-and-to-all-data-created-for-this-account.": "Associated users will lose access to the application and to all data created for this account.",
|
|
7854
|
+
"current_subjects": "Current Subjects",
|
|
7855
|
+
"merged_output": "Merged Output",
|
|
7856
|
+
"merge-subjects": "Merge Subjects",
|
|
7831
7857
|
"All Data": "All Data",
|
|
7832
|
-
"sbg-admin::remove-user-title": "
|
|
7833
|
-
"sbg-admin::remove-user-body": "
|
|
7858
|
+
"sbg-admin::remove-user-title": "Are you sure you want to remove the user from this account?",
|
|
7859
|
+
"sbg-admin::remove-user-body": "The user will lose access to the application and to all data created for this account.",
|
|
7834
7860
|
"Administrative-level-1": "Administrative Level 1",
|
|
7835
7861
|
"Administrative-level-2": "Administrative Level 2",
|
|
7836
7862
|
"merge-output": "Merge Output",
|
|
@@ -9095,6 +9121,7 @@ const en = {
|
|
|
9095
9121
|
FB00005: "Link copied to the clipboard",
|
|
9096
9122
|
FB00006: "Account successfully activated",
|
|
9097
9123
|
FB00007: "Make sure that this has been properly communicated, as the account admin holds critical user management privileges.",
|
|
9124
|
+
MD0004: "Are you sure you want to remove this user from this account?",
|
|
9098
9125
|
admin: {
|
|
9099
9126
|
"merge-subjects": "Merge Subjects",
|
|
9100
9127
|
"events": "Events",
|
|
@@ -9122,11 +9149,13 @@ const en = {
|
|
|
9122
9149
|
"reactivate-title": "Are you sure you want to reactivate this account?",
|
|
9123
9150
|
"reactivate-content": "All associated users will be able to access the application.",
|
|
9124
9151
|
"transfer-admin-rights": "Transfer admin rights",
|
|
9152
|
+
"transfer-account-admin-rights": "Transfer Account Admin Rights",
|
|
9125
9153
|
"remove-user-from-acc": "Remove user from account",
|
|
9126
9154
|
"remove-user-title": "Are you sure you want to remove the user from this account?",
|
|
9127
|
-
"remove-user-body": "The user will lose access to the application and to all data created for this account.",
|
|
9128
9155
|
"curr-admin": "Current Admin",
|
|
9129
9156
|
"new-admin": "New Admin",
|
|
9157
|
+
"role-after-transfer": "Your New Role",
|
|
9158
|
+
"role-after-transfer-help": "After transferring admin rights, you will be assigned this role",
|
|
9130
9159
|
"new-user": "New User",
|
|
9131
9160
|
"add-user": "Add User",
|
|
9132
9161
|
"edit-user": "Edit User",
|
|
@@ -9157,6 +9186,23 @@ const en = {
|
|
|
9157
9186
|
};
|
|
9158
9187
|
|
|
9159
9188
|
const fr = {
|
|
9189
|
+
"admin::events": "Événements",
|
|
9190
|
+
"admin::document": "Documents",
|
|
9191
|
+
"events": "Événements",
|
|
9192
|
+
"admin::Deleted": "Supprimé",
|
|
9193
|
+
"stakeholders": "Parties prenantes",
|
|
9194
|
+
"merge-locations": "Fusionner les lieux",
|
|
9195
|
+
"edit-account": "Modifier le compte",
|
|
9196
|
+
"Are-you-sure-you-want-to-remove-the-user-from-this-account?": "Êtes-vous sûr de vouloir retirer l'utilisateur de ce compte ?",
|
|
9197
|
+
"The-user-will-lose-access-to-the-application-and-to-all-data-created-for-this-account.": "L'utilisateur perdra l'accès à l'application et à toutes les données créées pour ce compte.",
|
|
9198
|
+
"merge": "Fusionner",
|
|
9199
|
+
"Are-you-sure-you-want-to-suspend-this-account?": "Êtes-vous sûr de vouloir suspendre ce compte ?",
|
|
9200
|
+
"Associated-users-will-lose-access-to-the-application-and-to-all-data-created-for-this-account.": "Les utilisateurs associés perdront l'accès à l'application et à toutes les données créées pour ce compte.",
|
|
9201
|
+
"current_subjects": "Sujets actuels",
|
|
9202
|
+
"merged_output": "Résultat fusionné",
|
|
9203
|
+
"merge-subjects": "Fusionner les sujets",
|
|
9204
|
+
"FB00007": "Assurez-vous que cela a été correctement communiqué, car l’administrateur du compte détient des privilèges critiques de gestion des utilisateurs.",
|
|
9205
|
+
"add-new": "Ajouter un nouveau",
|
|
9160
9206
|
"All Data": "Toutes les données",
|
|
9161
9207
|
"Site": "Site",
|
|
9162
9208
|
"Production Sites": "Sites de production",
|
|
@@ -11113,6 +11159,24 @@ const fr = {
|
|
|
11113
11159
|
};
|
|
11114
11160
|
|
|
11115
11161
|
const sp = {
|
|
11162
|
+
"admin::events": "Eventos",
|
|
11163
|
+
"admin::document": "Documentos",
|
|
11164
|
+
"events": "Eventos",
|
|
11165
|
+
"admin::Deleted": "Eliminado",
|
|
11166
|
+
"stakeholders": "Partes interesadas",
|
|
11167
|
+
"merge-locations": "Fusionar ubicaciones",
|
|
11168
|
+
"edit-account": "Editar cuenta",
|
|
11169
|
+
"Are-you-sure-you-want-to-remove-the-user-from-this-account?": "¿Está seguro de que desea eliminar al usuario de esta cuenta?",
|
|
11170
|
+
"The-user-will-lose-access-to-the-application-and-to-all-data-created-for-this-account.": "El usuario perderá el acceso a la aplicación y a todos los datos creados para esta cuenta.",
|
|
11171
|
+
"merge": "Fusionar",
|
|
11172
|
+
"FB00007": "Asegúrese de que esto se haya comunicado correctamente, ya que el administrador de la cuenta tiene privilegios críticos de gestión de usuarios.",
|
|
11173
|
+
"Custodian": "Custodio",
|
|
11174
|
+
"add-new": "Añadir nuevo",
|
|
11175
|
+
"Are-you-sure-you-want-to-suspend-this-account?": "¿Está seguro de que desea suspender esta cuenta?",
|
|
11176
|
+
"Associated-users-will-lose-access-to-the-application-and-to-all-data-created-for-this-account.": "Los usuarios asociados perderán el acceso a la aplicación y a todos los datos creados para esta cuenta.",
|
|
11177
|
+
"current_subjects": "Sujetos actuales",
|
|
11178
|
+
"merged_output": "Resultado fusionado",
|
|
11179
|
+
"merge-subjects": "Fusionar sujetos",
|
|
11116
11180
|
"All Data": "Todos los datos",
|
|
11117
11181
|
"Site": "Sitio",
|
|
11118
11182
|
"Production Sites": "Centros de producción",
|
|
@@ -13050,11 +13114,14 @@ const sp = {
|
|
|
13050
13114
|
"reactivate-title": "¿Está seguro de que desea reactivar esta cuenta?",
|
|
13051
13115
|
"reactivate-content": "Todos los usuarios asociados podrán acceder a la aplicación.",
|
|
13052
13116
|
"transfer-admin-rights": "Transferir derechos de administrador",
|
|
13117
|
+
"transfer-account-admin-rights": "Transferir Derechos de Administrador de Cuenta",
|
|
13053
13118
|
"remove-user-from-acc": "Eliminar usuario de la cuenta",
|
|
13054
13119
|
"remove-user-title": "¿Está seguro de que desea eliminar al usuario de esta cuenta?",
|
|
13055
13120
|
"remove-user-body": "El usuario perderá el acceso a la aplicación y a todos los datos creados para esta cuenta.",
|
|
13056
13121
|
"curr-admin": "Administrador Actual",
|
|
13057
13122
|
"new-admin": "Nuevo Administrador",
|
|
13123
|
+
"role-after-transfer": "Su Nuevo Rol",
|
|
13124
|
+
"role-after-transfer-help": "Después de transferir los derechos de administrador, se le asignará este rol",
|
|
13058
13125
|
"add-user": "Añadir Usuario",
|
|
13059
13126
|
"edit-user": "Editar Usuario",
|
|
13060
13127
|
"edit-account": "Editar Cuenta",
|
package/package.json
CHANGED
|
@@ -13,13 +13,20 @@ function AuthForm ({
|
|
|
13
13
|
errors,
|
|
14
14
|
t = (key) => key,
|
|
15
15
|
executeRecaptcha = () => {},
|
|
16
|
-
getCurrentStep = () => {}
|
|
16
|
+
getCurrentStep = () => {},
|
|
17
|
+
theme,
|
|
17
18
|
}){
|
|
18
19
|
const [formInstance] = Form.useForm(form);
|
|
19
20
|
const [currentStep, setCurrentStep] = useState(0);
|
|
20
21
|
const [allFormValues, setAllFormValues] = useState(initialValues);
|
|
21
22
|
const [formErrors, setFormErrors] = useState(null);
|
|
22
23
|
|
|
24
|
+
const buttonStyle = theme?.colorPrimary ? {
|
|
25
|
+
backgroundColor: theme.colorPrimary,
|
|
26
|
+
borderColor: theme.colorPrimary,
|
|
27
|
+
} : {};
|
|
28
|
+
|
|
29
|
+
|
|
23
30
|
const isMultiStep = !!steps;
|
|
24
31
|
const currentFields = isMultiStep ? steps?.[currentStep]?.fields : fields || [];
|
|
25
32
|
|
|
@@ -166,6 +173,7 @@ function AuthForm ({
|
|
|
166
173
|
name: field.name,
|
|
167
174
|
label: field.label,
|
|
168
175
|
rules: field.rules,
|
|
176
|
+
dependencies: field.dependencies,
|
|
169
177
|
style: { marginBottom: 0 }
|
|
170
178
|
};
|
|
171
179
|
if (field.valuePropName && field.type !== 'select') {
|
|
@@ -217,6 +225,7 @@ function AuthForm ({
|
|
|
217
225
|
htmlType="submit"
|
|
218
226
|
disabled={isLastStep && !allFieldsFilled}
|
|
219
227
|
block className="normal-br"
|
|
228
|
+
style={buttonStyle}
|
|
220
229
|
>
|
|
221
230
|
{isLastStep ? submitText : t("Next")}
|
|
222
231
|
</BorderedButton>
|
|
@@ -225,14 +234,14 @@ function AuthForm ({
|
|
|
225
234
|
}}
|
|
226
235
|
</Form.Item>
|
|
227
236
|
<div className="buttons" style={{ marginTop: 0}}>
|
|
228
|
-
<BorderedButton onClick={prev} block className="normal-br">
|
|
237
|
+
<BorderedButton onClick={prev} block className="normal-br" style={buttonStyle}>
|
|
229
238
|
{t("Back")}
|
|
230
239
|
</BorderedButton>
|
|
231
240
|
</div>
|
|
232
241
|
</div>
|
|
233
242
|
) : (
|
|
234
243
|
<div className="buttons" style={{ marginTop: isMultiStep ? '16px' : 0}}>
|
|
235
|
-
<BorderedButton type="primary" htmlType="submit" block className="normal-br">
|
|
244
|
+
<BorderedButton type="primary" htmlType="submit" block className="normal-br" style={buttonStyle}>
|
|
236
245
|
{isMultiStep ? t("Next") : submitText}
|
|
237
246
|
</BorderedButton>
|
|
238
247
|
</div>
|
|
@@ -4,12 +4,36 @@ import { renderNumber } from "../../../../../../../../utils/numbers";
|
|
|
4
4
|
import { getRangeOfTicks } from "../../../../../../../../../helpers/chart";
|
|
5
5
|
import { Column } from "@antv/g2plot";
|
|
6
6
|
import { theme } from "antd";
|
|
7
|
+
import AdminService from "../../../../../../../../services/AdminService";
|
|
7
8
|
|
|
8
9
|
const { useToken } = theme;
|
|
9
10
|
|
|
10
|
-
export default function useTopContributors({ container,
|
|
11
|
+
export default function useTopContributors({ container, params, t }) {
|
|
11
12
|
const [mainGraph, setMainGraph] = useState(null);
|
|
13
|
+
const [data, setData] = useState([]);
|
|
14
|
+
const [loading, setLoading] = useState(false);
|
|
12
15
|
const { token } = useToken();
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const fetchTopContributors = async () => {
|
|
19
|
+
try {
|
|
20
|
+
setLoading(true);
|
|
21
|
+
const response = await AdminService.getTopContributors({ params });
|
|
22
|
+
const transformedData = (response?.data || []).map(item => ({
|
|
23
|
+
label: item.name,
|
|
24
|
+
Score: item.value
|
|
25
|
+
}));
|
|
26
|
+
setData(transformedData);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error("Error fetching top contributors:", error);
|
|
29
|
+
setData([]);
|
|
30
|
+
} finally {
|
|
31
|
+
setLoading(false);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
fetchTopContributors();
|
|
36
|
+
}, [params]);
|
|
13
37
|
useEffect(() => {
|
|
14
38
|
if (container.current) {
|
|
15
39
|
if (mainGraph) {
|
|
@@ -80,4 +104,6 @@ export default function useTopContributors({ container, data = [], t }) {
|
|
|
80
104
|
}
|
|
81
105
|
}
|
|
82
106
|
}, [container, data, t, token]);
|
|
107
|
+
|
|
108
|
+
return { loading };
|
|
83
109
|
}
|
|
@@ -4,11 +4,10 @@ import useTopContributors from "./hook.js";
|
|
|
4
4
|
|
|
5
5
|
import Style from "../style.js";
|
|
6
6
|
|
|
7
|
-
export default function TopContributors({
|
|
7
|
+
export default function TopContributors({ params, t }) {
|
|
8
8
|
const container = useRef(null);
|
|
9
9
|
|
|
10
|
-
useTopContributors({ container,
|
|
11
|
-
console.log("topcontributorshhhh", data);
|
|
10
|
+
const { loading } = useTopContributors({ container, params, t });
|
|
12
11
|
return (
|
|
13
12
|
<Widget
|
|
14
13
|
title={t(`admin::top-contributors`)}
|
|
@@ -12,7 +12,6 @@ export default function useUserGrowth({ container, data: mainData = {}, t, trans
|
|
|
12
12
|
const [mainGraph, setMainGraph] = useState(null);
|
|
13
13
|
const [data, setData] = useState([]);
|
|
14
14
|
const { token } = useToken();
|
|
15
|
-
console.log("mainData", mainData);
|
|
16
15
|
const fetchData = () => {
|
|
17
16
|
const { dates = [] } = mainData;
|
|
18
17
|
const _data = [];
|
|
@@ -9,13 +9,11 @@ export default function UserGrowth({ loading, data = [], t, translationKeys, fet
|
|
|
9
9
|
const [selectValue, setSelectValue] = useState(selectOptions[0]?.value);
|
|
10
10
|
|
|
11
11
|
useUserGrowth({ container, data, t, translationKeys });
|
|
12
|
-
console.log("usergrowthhhhh", data);
|
|
13
|
-
|
|
14
12
|
useEffect(() => {
|
|
15
13
|
if (typeof fetchUserGrowth === "function") {
|
|
16
14
|
fetchUserGrowth(selectValue);
|
|
17
15
|
}
|
|
18
|
-
}, [selectValue]);
|
|
16
|
+
}, [selectValue, fetchUserGrowth]);
|
|
19
17
|
|
|
20
18
|
return (
|
|
21
19
|
<Widget
|
package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/index.jsx
CHANGED
|
@@ -28,7 +28,7 @@ export default function UserStatistics({
|
|
|
28
28
|
<UserActivity loading={loading} data={data.userActivityData || []} t={t} />
|
|
29
29
|
|
|
30
30
|
<div className="flex flex-row flex-col-mobile gap-6">
|
|
31
|
-
<TopContributors
|
|
31
|
+
<TopContributors params={{}} t={t} />
|
|
32
32
|
<UserGrowth
|
|
33
33
|
t={t}
|
|
34
34
|
loading={loadingUserGrowth}
|
|
@@ -1,14 +1,58 @@
|
|
|
1
1
|
import Modal from "../../../../Modal/index.jsx";
|
|
2
|
-
import { Form, Input, Select } from "antd";
|
|
3
|
-
|
|
2
|
+
import { Form, Input, Select, Alert } from "antd";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
|
|
5
|
+
export default function AddAccountModal({
|
|
6
|
+
isOpen,
|
|
7
|
+
t,
|
|
8
|
+
onClose,
|
|
9
|
+
userTypes = [],
|
|
10
|
+
inviteAccount,
|
|
11
|
+
fetchData = () => {},
|
|
12
|
+
}) {
|
|
4
13
|
const [MainForm] = Form.useForm();
|
|
14
|
+
const [loading, setLoading] = useState(false);
|
|
15
|
+
const [emailError, setEmailError] = useState(null);
|
|
16
|
+
|
|
17
|
+
const onSubmit = async () => {
|
|
18
|
+
try {
|
|
19
|
+
const data = await MainForm.validateFields();
|
|
20
|
+
setLoading(true);
|
|
21
|
+
setEmailError(null);
|
|
22
|
+
|
|
23
|
+
await inviteAccount({
|
|
24
|
+
name: data.name,
|
|
25
|
+
email: data.email,
|
|
26
|
+
type: data.type,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
await fetchData();
|
|
30
|
+
onClose();
|
|
31
|
+
MainForm.resetFields();
|
|
32
|
+
} catch (err) {
|
|
33
|
+
if (err.errorFields) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (err?.response?.data?.statusCode === 400 || err?.statusCode === 400) {
|
|
38
|
+
const errorMessage = err?.response?.data?.message || err?.message;
|
|
39
|
+
if (errorMessage && (
|
|
40
|
+
errorMessage.includes("email already exists") ||
|
|
41
|
+
errorMessage.includes("This email already exists")
|
|
42
|
+
)) {
|
|
43
|
+
setEmailError(errorMessage);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
console.error(err);
|
|
47
|
+
} finally {
|
|
48
|
+
setLoading(false);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
5
51
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})
|
|
11
|
-
.catch((err) => console.log(err));
|
|
52
|
+
const handleEmailChange = () => {
|
|
53
|
+
if (emailError) {
|
|
54
|
+
setEmailError(null);
|
|
55
|
+
}
|
|
12
56
|
};
|
|
13
57
|
|
|
14
58
|
return (
|
|
@@ -18,14 +62,42 @@ export default function AddAccountModal({ isOpen, t, onClose, userTypes = [] })
|
|
|
18
62
|
t={t}
|
|
19
63
|
onClose={onClose}
|
|
20
64
|
onSuccess={onSubmit}
|
|
65
|
+
loading={loading}
|
|
21
66
|
>
|
|
22
67
|
<Form form={MainForm} layout="vertical" className="main-form pb-2">
|
|
23
|
-
<Form.Item name="
|
|
68
|
+
<Form.Item name="name" label={t("Name")} rules={[{ required: true }]}>
|
|
24
69
|
<Input placeholder={t("Type")} />
|
|
25
70
|
</Form.Item>
|
|
71
|
+
|
|
72
|
+
<Form.Item
|
|
73
|
+
name="email"
|
|
74
|
+
label={t("Email")}
|
|
75
|
+
rules={[
|
|
76
|
+
{ required: true, message: t("Email is required") },
|
|
77
|
+
{ type: "email", message: t("Please enter a valid email") }
|
|
78
|
+
]}
|
|
79
|
+
validateStatus={emailError ? "error" : ""}
|
|
80
|
+
>
|
|
81
|
+
<Input
|
|
82
|
+
placeholder={t("Type")}
|
|
83
|
+
onChange={handleEmailChange}
|
|
84
|
+
/>
|
|
85
|
+
</Form.Item>
|
|
86
|
+
|
|
87
|
+
{emailError && (
|
|
88
|
+
<Alert
|
|
89
|
+
message={emailError}
|
|
90
|
+
type="error"
|
|
91
|
+
showIcon
|
|
92
|
+
className="mb-2"
|
|
93
|
+
closable
|
|
94
|
+
onClose={() => setEmailError(null)}
|
|
95
|
+
/>
|
|
96
|
+
)}
|
|
97
|
+
|
|
26
98
|
<Form.Item
|
|
27
99
|
name="type"
|
|
28
|
-
label={t("
|
|
100
|
+
label={t("Type")}
|
|
29
101
|
rules={[{ required: true }]}
|
|
30
102
|
>
|
|
31
103
|
<Select placeholder={t("Select")} options={userTypes} />
|