datastake-daf 0.6.763 → 0.6.764
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 +93 -60
- package/dist/hooks/index.js +1 -1
- package/dist/layouts/index.js +36 -11
- package/dist/pages/index.js +1872 -995
- package/dist/services/index.js +1 -21
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +9 -4
- package/src/@daf/core/components/Table/index.jsx +2 -2
- package/src/@daf/core/components/UI/KeyIndicatorNavigateLabel/index.jsx +29 -0
- package/src/@daf/hooks/useFilters.js +1 -1
- package/src/@daf/layouts/AppLayout/components/MobileDrawer/index.js +4 -2
- package/src/@daf/layouts/AppLayout/components/UserDropdown/index.js +23 -2
- package/src/@daf/layouts/AppLayout/index.jsx +2 -0
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/config.js +7 -6
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +2 -1
- package/src/@daf/pages/Dashboards/SupplyChain/components/KeyIndicators/config.js +29 -53
- package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +2 -2
- package/src/@daf/pages/Dashboards/UserDashboard/components/KeyIndicators/config.js +36 -70
- package/src/@daf/pages/Documents/index.jsx +9 -13
- package/src/@daf/pages/Events/Activities/index.jsx +8 -21
- package/src/@daf/pages/Events/Incidents/index.jsx +8 -21
- package/src/@daf/pages/Events/index.jsx +8 -20
- package/src/@daf/pages/Locations/MineSite/index.jsx +8 -21
- package/src/@daf/pages/Locations/index.jsx +9 -12
- package/src/@daf/pages/Partners/columns.js +421 -0
- package/src/@daf/pages/Partners/config.js +32 -0
- package/src/@daf/pages/Partners/create.jsx +145 -0
- package/src/@daf/pages/Partners/edit.jsx +98 -0
- package/src/@daf/pages/Partners/hook.js +153 -0
- package/src/@daf/pages/Partners/index.jsx +233 -8
- package/src/@daf/pages/Stakeholders/Operators/index.jsx +8 -22
- package/src/@daf/pages/Stakeholders/Workers/index.jsx +8 -21
- package/src/@daf/pages/Stakeholders/index.jsx +9 -10
- package/src/@daf/pages/hook.js +34 -0
- package/src/@daf/services/PartnerService.js +1 -16
- package/src/index.js +1 -1
- package/src/pages.js +1 -0
package/dist/components/index.js
CHANGED
|
@@ -5901,10 +5901,10 @@ function DAFTable(_ref) {
|
|
|
5901
5901
|
}) : filtersConfig;
|
|
5902
5902
|
}, [sourcesKey, sources, filtersConfig, t]);
|
|
5903
5903
|
React.useEffect(() => {
|
|
5904
|
-
if (data) {
|
|
5904
|
+
if (data && Array.isArray(data)) {
|
|
5905
5905
|
setSource(data);
|
|
5906
5906
|
}
|
|
5907
|
-
}, [data]);
|
|
5907
|
+
}, [data, data.length]);
|
|
5908
5908
|
const paginationPageSize = pagination === null || pagination === void 0 ? void 0 : pagination.pageSize;
|
|
5909
5909
|
const dataSource = React.useMemo(() => {
|
|
5910
5910
|
const pageSize = paginationPageSize ? paginationPageSize : source.length > 10 ? source.length : 10;
|
|
@@ -10140,37 +10140,42 @@ const handleDataLinkGroupWithTableKeys = ({
|
|
|
10140
10140
|
}
|
|
10141
10141
|
};
|
|
10142
10142
|
|
|
10143
|
-
const handleDataLinkWithTableKeys =
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10143
|
+
const handleDataLinkWithTableKeys = _ref => {
|
|
10144
|
+
var _inputConfig$meta, _inputConfig$meta3, _inputConfig$meta4, _inputConfig$meta5;
|
|
10145
|
+
let {
|
|
10146
|
+
inputConfig,
|
|
10147
|
+
inputKey,
|
|
10148
|
+
value,
|
|
10149
|
+
level,
|
|
10150
|
+
t,
|
|
10151
|
+
rootForm,
|
|
10152
|
+
allData,
|
|
10153
|
+
user,
|
|
10154
|
+
getApiBaseUrl = () => {},
|
|
10155
|
+
getAppHeader = () => {},
|
|
10156
|
+
app,
|
|
10157
|
+
TreeNodeComponent
|
|
10158
|
+
} = _ref;
|
|
10159
|
+
if ((inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type) !== 'dataLink' || !(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta = inputConfig.meta) !== null && _inputConfig$meta !== void 0 && _inputConfig$meta.tableKeys)) {
|
|
10158
10160
|
return null;
|
|
10159
10161
|
}
|
|
10160
10162
|
const tableKeys = inputConfig.meta.tableKeys;
|
|
10161
|
-
const isAjaxModal = React.useMemo(() =>
|
|
10163
|
+
const isAjaxModal = React.useMemo(() => {
|
|
10164
|
+
var _inputConfig$meta2;
|
|
10165
|
+
return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
|
|
10166
|
+
}, [inputConfig]);
|
|
10162
10167
|
const ajaxModalValues = useAjaxModal$2({
|
|
10163
10168
|
name: inputKey,
|
|
10164
10169
|
user,
|
|
10165
|
-
namespace: inputConfig
|
|
10166
|
-
skipFetch: inputConfig
|
|
10170
|
+
namespace: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta3 = inputConfig.meta) === null || _inputConfig$meta3 === void 0 ? void 0 : _inputConfig$meta3.namespace,
|
|
10171
|
+
skipFetch: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta4 = inputConfig.meta) === null || _inputConfig$meta4 === void 0 ? void 0 : _inputConfig$meta4.skipFetch,
|
|
10167
10172
|
isAjaxModal,
|
|
10168
|
-
formScope: inputConfig
|
|
10173
|
+
formScope: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta5 = inputConfig.meta) === null || _inputConfig$meta5 === void 0 ? void 0 : _inputConfig$meta5.formScope,
|
|
10169
10174
|
APP: app,
|
|
10170
10175
|
apiBaseUrl: getApiBaseUrl(),
|
|
10171
10176
|
_getAppHeader: getAppHeader
|
|
10172
10177
|
});
|
|
10173
|
-
const dataLinkForm = ajaxModalValues
|
|
10178
|
+
const dataLinkForm = ajaxModalValues === null || ajaxModalValues === void 0 ? void 0 : ajaxModalValues.form;
|
|
10174
10179
|
const createInputsAndValues = item => {
|
|
10175
10180
|
const inputs = {};
|
|
10176
10181
|
const values = {};
|
|
@@ -10183,19 +10188,20 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10183
10188
|
};
|
|
10184
10189
|
const isUploadFieldEmpty = (fieldKey, itemToCheck) => {
|
|
10185
10190
|
if (uploadTypeFields.includes(fieldKey)) {
|
|
10186
|
-
const itemValue = itemToCheck
|
|
10191
|
+
const itemValue = itemToCheck === null || itemToCheck === void 0 ? void 0 : itemToCheck[fieldKey];
|
|
10187
10192
|
return itemValue === undefined || itemValue === null || Array.isArray(itemValue) && itemValue.length === 0;
|
|
10188
10193
|
}
|
|
10189
10194
|
return false;
|
|
10190
10195
|
};
|
|
10191
10196
|
const processedTableKeys = processConditionalTableKeys(tableKeys, item);
|
|
10192
10197
|
processedTableKeys.filter(tableKey => tableKey !== 'datastakeId').filter(tableKey => !isUploadFieldEmpty(tableKey, item)).forEach(tableKey => {
|
|
10193
|
-
|
|
10198
|
+
var _dataLinkForm$identif;
|
|
10199
|
+
const formInputConfig = (dataLinkForm === null || dataLinkForm === void 0 ? void 0 : dataLinkForm[tableKey]) || (dataLinkForm === null || dataLinkForm === void 0 || (_dataLinkForm$identif = dataLinkForm['identification']) === null || _dataLinkForm$identif === void 0 ? void 0 : _dataLinkForm$identif[tableKey]);
|
|
10194
10200
|
if (formInputConfig) {
|
|
10195
|
-
|
|
10196
|
-
|
|
10201
|
+
var _item$linking, _formInputConfig$meta, _formInputConfig$tabl;
|
|
10202
|
+
inputs[tableKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
|
|
10197
10203
|
label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
|
|
10198
|
-
};
|
|
10204
|
+
});
|
|
10199
10205
|
if (formInputConfig.label && typeof formInputConfig.label === 'object') {
|
|
10200
10206
|
const dynamicLabelKeys = Object.keys(formInputConfig.label);
|
|
10201
10207
|
let resolvedLabel = null;
|
|
@@ -10203,7 +10209,7 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10203
10209
|
const parts = labelKey.split(' is ');
|
|
10204
10210
|
if (parts.length === 2) {
|
|
10205
10211
|
const [conditionKey, conditionValue] = parts;
|
|
10206
|
-
if (item
|
|
10212
|
+
if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
|
|
10207
10213
|
resolvedLabel = formInputConfig.label[labelKey];
|
|
10208
10214
|
break;
|
|
10209
10215
|
}
|
|
@@ -10211,16 +10217,17 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10211
10217
|
}
|
|
10212
10218
|
inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
|
|
10213
10219
|
}
|
|
10214
|
-
values[tableKey] = item
|
|
10220
|
+
values[tableKey] = (item === null || item === void 0 || (_item$linking = item.linking) === null || _item$linking === void 0 || (_item$linking = _item$linking.SCL) === null || _item$linking === void 0 || (_item$linking = _item$linking[item === null || item === void 0 ? void 0 : item[tableKey]]) === null || _item$linking === void 0 ? void 0 : _item$linking.name) || item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$meta = formInputConfig.meta) === null || _formInputConfig$meta === void 0 ? void 0 : _formInputConfig$meta.onNewSetValueKey] || (item === null || item === void 0 ? void 0 : item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$tabl = formInputConfig.tableLabel) === null || _formInputConfig$tabl === void 0 ? void 0 : _formInputConfig$tabl.toLowerCase()]) || (item === null || item === void 0 ? void 0 : item[tableKey]);
|
|
10215
10221
|
} else {
|
|
10222
|
+
var _item$linking2;
|
|
10216
10223
|
inputs[tableKey] = {
|
|
10217
10224
|
label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
|
|
10218
|
-
type: inputConfig
|
|
10225
|
+
type: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type
|
|
10219
10226
|
};
|
|
10220
|
-
values[tableKey] = item
|
|
10227
|
+
values[tableKey] = (item === null || item === void 0 || (_item$linking2 = item.linking) === null || _item$linking2 === void 0 || (_item$linking2 = _item$linking2.SCL) === null || _item$linking2 === void 0 || (_item$linking2 = _item$linking2[item === null || item === void 0 ? void 0 : item[tableKey]]) === null || _item$linking2 === void 0 ? void 0 : _item$linking2.name) || (item === null || item === void 0 ? void 0 : item[tableKey]);
|
|
10221
10228
|
}
|
|
10222
10229
|
});
|
|
10223
|
-
if (dataLinkForm
|
|
10230
|
+
if (dataLinkForm !== null && dataLinkForm !== void 0 && dataLinkForm.identification && typeof dataLinkForm.identification === 'object') {
|
|
10224
10231
|
Object.keys(dataLinkForm.identification).filter(fieldKey => {
|
|
10225
10232
|
if (uploadTypeFields.includes(fieldKey)) {
|
|
10226
10233
|
return !isUploadFieldEmpty(fieldKey, item);
|
|
@@ -10230,11 +10237,11 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10230
10237
|
const formInputConfig = dataLinkForm.identification[fieldKey];
|
|
10231
10238
|
return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
|
|
10232
10239
|
}).forEach(fieldKey => {
|
|
10240
|
+
var _item$linking3, _formInputConfig$tabl2;
|
|
10233
10241
|
const formInputConfig = dataLinkForm.identification[fieldKey];
|
|
10234
|
-
inputs[fieldKey] = {
|
|
10235
|
-
...formInputConfig,
|
|
10242
|
+
inputs[fieldKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
|
|
10236
10243
|
label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
|
|
10237
|
-
};
|
|
10244
|
+
});
|
|
10238
10245
|
if (formInputConfig.label && typeof formInputConfig.label === 'object') {
|
|
10239
10246
|
const dynamicLabelKeys = Object.keys(formInputConfig.label);
|
|
10240
10247
|
let resolvedLabel = null;
|
|
@@ -10242,7 +10249,7 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10242
10249
|
const parts = labelKey.split(' is ');
|
|
10243
10250
|
if (parts.length === 2) {
|
|
10244
10251
|
const [conditionKey, conditionValue] = parts;
|
|
10245
|
-
if (item
|
|
10252
|
+
if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
|
|
10246
10253
|
resolvedLabel = formInputConfig.label[labelKey];
|
|
10247
10254
|
break;
|
|
10248
10255
|
}
|
|
@@ -10250,7 +10257,7 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10250
10257
|
}
|
|
10251
10258
|
inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
|
|
10252
10259
|
}
|
|
10253
|
-
values[fieldKey] = item
|
|
10260
|
+
values[fieldKey] = (item === null || item === void 0 || (_item$linking3 = item.linking) === null || _item$linking3 === void 0 || (_item$linking3 = _item$linking3.SCL) === null || _item$linking3 === void 0 || (_item$linking3 = _item$linking3[item === null || item === void 0 ? void 0 : item[fieldKey]]) === null || _item$linking3 === void 0 ? void 0 : _item$linking3.name) || (item === null || item === void 0 ? void 0 : item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$tabl2 = formInputConfig.tableLabel) === null || _formInputConfig$tabl2 === void 0 ? void 0 : _formInputConfig$tabl2.toLowerCase()]) || (item === null || item === void 0 ? void 0 : item[fieldKey]);
|
|
10254
10261
|
});
|
|
10255
10262
|
}
|
|
10256
10263
|
return {
|
|
@@ -10260,7 +10267,7 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10260
10267
|
};
|
|
10261
10268
|
if (Array.isArray(value)) {
|
|
10262
10269
|
return value.map((item, itemIndex) => {
|
|
10263
|
-
const datastakeIdValue = item
|
|
10270
|
+
const datastakeIdValue = item === null || item === void 0 ? void 0 : item.datastakeId;
|
|
10264
10271
|
const {
|
|
10265
10272
|
inputs,
|
|
10266
10273
|
values
|
|
@@ -10269,9 +10276,9 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10269
10276
|
return null;
|
|
10270
10277
|
}
|
|
10271
10278
|
return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
|
|
10272
|
-
nodeKey: datastakeIdValue || t(
|
|
10279
|
+
nodeKey: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
|
|
10273
10280
|
config: {
|
|
10274
|
-
label: datastakeIdValue || t(
|
|
10281
|
+
label: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
|
|
10275
10282
|
type: 'custom-datalink',
|
|
10276
10283
|
inputs: inputs
|
|
10277
10284
|
},
|
|
@@ -10285,10 +10292,10 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10285
10292
|
getApiBaseUrl: getApiBaseUrl,
|
|
10286
10293
|
getAppHeader: getAppHeader,
|
|
10287
10294
|
app: app
|
|
10288
|
-
},
|
|
10295
|
+
}, "".concat(inputKey, "-").concat(itemIndex));
|
|
10289
10296
|
});
|
|
10290
10297
|
} else {
|
|
10291
|
-
const datastakeIdValue = value
|
|
10298
|
+
const datastakeIdValue = value === null || value === void 0 ? void 0 : value.datastakeId;
|
|
10292
10299
|
const {
|
|
10293
10300
|
inputs,
|
|
10294
10301
|
values
|
|
@@ -10313,25 +10320,24 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10313
10320
|
getApiBaseUrl: getApiBaseUrl,
|
|
10314
10321
|
getAppHeader: getAppHeader,
|
|
10315
10322
|
app: app
|
|
10316
|
-
},
|
|
10323
|
+
}, "".concat(inputKey, "-single"));
|
|
10317
10324
|
}
|
|
10318
10325
|
};
|
|
10319
10326
|
|
|
10320
|
-
const handleGroupChildren =
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
if (!(config !== null && config !== void 0 && config.inputs)) {
|
|
10327
|
+
const handleGroupChildren = ({
|
|
10328
|
+
config,
|
|
10329
|
+
value,
|
|
10330
|
+
allData,
|
|
10331
|
+
level,
|
|
10332
|
+
t,
|
|
10333
|
+
rootForm,
|
|
10334
|
+
user,
|
|
10335
|
+
getApiBaseUrl = () => {},
|
|
10336
|
+
getAppHeader = () => {},
|
|
10337
|
+
app,
|
|
10338
|
+
TreeNodeComponent
|
|
10339
|
+
}) => {
|
|
10340
|
+
if (!config?.inputs) {
|
|
10335
10341
|
return null;
|
|
10336
10342
|
}
|
|
10337
10343
|
const inputKeys = Object.keys(config.inputs);
|
|
@@ -10344,7 +10350,7 @@ const handleGroupChildren = _ref => {
|
|
|
10344
10350
|
if (value && typeof value === 'object' && value[inputKey]) {
|
|
10345
10351
|
inputValue = value[inputKey];
|
|
10346
10352
|
} else {
|
|
10347
|
-
inputValue = allData
|
|
10353
|
+
inputValue = allData?.[inputKey];
|
|
10348
10354
|
}
|
|
10349
10355
|
return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
|
|
10350
10356
|
nodeKey: inputKey,
|
|
@@ -44109,7 +44115,7 @@ const useFilters = ({
|
|
|
44109
44115
|
return Math.ceil(pagination.total / pagination.pageSize);
|
|
44110
44116
|
}, [pagination]);
|
|
44111
44117
|
const canGoPrev = React.useMemo(() => pagination.current !== 1, [pagination]);
|
|
44112
|
-
const canGoNext = React.useMemo(() => pagination.current !== totalPages && totalPages, [pagination, totalPages]);
|
|
44118
|
+
const canGoNext = React.useMemo(() => pagination.current !== totalPages && totalPages > 0, [pagination, totalPages]);
|
|
44113
44119
|
const goPrev = () => {
|
|
44114
44120
|
if (!canGoPrev) {
|
|
44115
44121
|
return;
|
|
@@ -60269,6 +60275,32 @@ CountryFlag.propTypes = {
|
|
|
60269
60275
|
hasTooltip: PropTypes__default["default"].bool
|
|
60270
60276
|
};
|
|
60271
60277
|
|
|
60278
|
+
function KeyIndicatorNavigateLabel(_ref) {
|
|
60279
|
+
let {
|
|
60280
|
+
t,
|
|
60281
|
+
getRedirectLink,
|
|
60282
|
+
theme,
|
|
60283
|
+
label,
|
|
60284
|
+
link
|
|
60285
|
+
} = _ref;
|
|
60286
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
60287
|
+
className: "flex",
|
|
60288
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
60289
|
+
className: "flex-1",
|
|
60290
|
+
children: t(label)
|
|
60291
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
60292
|
+
className: "cursor-pointer",
|
|
60293
|
+
onClick: () => window.open(getRedirectLink(link), '_blank'),
|
|
60294
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
60295
|
+
name: "LinkNewTab",
|
|
60296
|
+
width: 16,
|
|
60297
|
+
height: 16,
|
|
60298
|
+
color: theme.colorPrimary
|
|
60299
|
+
})
|
|
60300
|
+
})]
|
|
60301
|
+
});
|
|
60302
|
+
}
|
|
60303
|
+
|
|
60272
60304
|
var Style$5 = styled__default["default"].div`
|
|
60273
60305
|
display: flex;
|
|
60274
60306
|
flex-direction: column;
|
|
@@ -61610,6 +61642,7 @@ exports.InformationChannelsDataPoint = DataPoint;
|
|
|
61610
61642
|
exports.InformationChannelsSubject = Subject;
|
|
61611
61643
|
exports.InformationChannelsView = InformationChannel;
|
|
61612
61644
|
exports.InformationUnavailable = InformationUnavailable;
|
|
61645
|
+
exports.KeyIndicatorNavigateLabel = KeyIndicatorNavigateLabel;
|
|
61613
61646
|
exports.KeyIndicators = KeyIndicatorsWidget$1;
|
|
61614
61647
|
exports.KeyIndicatorsDetails = KeyIndicatorsDetails;
|
|
61615
61648
|
exports.LineChart = LineChart;
|
package/dist/hooks/index.js
CHANGED
|
@@ -418,7 +418,7 @@ const useFilters = ({
|
|
|
418
418
|
return Math.ceil(pagination.total / pagination.pageSize);
|
|
419
419
|
}, [pagination]);
|
|
420
420
|
const canGoPrev = React.useMemo(() => pagination.current !== 1, [pagination]);
|
|
421
|
-
const canGoNext = React.useMemo(() => pagination.current !== totalPages && totalPages, [pagination, totalPages]);
|
|
421
|
+
const canGoNext = React.useMemo(() => pagination.current !== totalPages && totalPages > 0, [pagination, totalPages]);
|
|
422
422
|
const goPrev = () => {
|
|
423
423
|
if (!canGoPrev) {
|
|
424
424
|
return;
|
package/dist/layouts/index.js
CHANGED
|
@@ -4583,6 +4583,10 @@ CustomIcon.propTypes = {
|
|
|
4583
4583
|
size: PropTypes__default["default"].number
|
|
4584
4584
|
};
|
|
4585
4585
|
|
|
4586
|
+
const userIsAdmin = user => {
|
|
4587
|
+
return user?.role?.id === 'APP_ADMIN';
|
|
4588
|
+
};
|
|
4589
|
+
|
|
4586
4590
|
/* eslint-disable no-unused-vars */
|
|
4587
4591
|
const featureIsNotAvailable = (t, isDemo) => {
|
|
4588
4592
|
antd.Modal.error({
|
|
@@ -5800,10 +5804,12 @@ function MobileDrawer({
|
|
|
5800
5804
|
userHelpers = {},
|
|
5801
5805
|
isDev = false,
|
|
5802
5806
|
selectedProject,
|
|
5803
|
-
theme = {}
|
|
5807
|
+
theme = {},
|
|
5808
|
+
dropdownItems = []
|
|
5804
5809
|
}) {
|
|
5805
5810
|
const items = React.useMemo(() => sidenavConfig[mod] || [], [sidenavConfig, mod]);
|
|
5806
|
-
const
|
|
5811
|
+
const appsWithPartners = ['tazama', 'nashiriki', 'wazi', 'hatua'];
|
|
5812
|
+
const canViewPartners = React.useMemo(() => appsWithPartners.includes(mod), [mod]);
|
|
5807
5813
|
const canViewProjects = checkPermission({
|
|
5808
5814
|
permission: 'projects.canView',
|
|
5809
5815
|
permissions: user?.role?.permissions
|
|
@@ -5856,7 +5862,7 @@ function MobileDrawer({
|
|
|
5856
5862
|
}, {
|
|
5857
5863
|
type: 'link',
|
|
5858
5864
|
name: t('Partners'),
|
|
5859
|
-
path: `/app
|
|
5865
|
+
path: `/app/partners`,
|
|
5860
5866
|
isDashboard: true,
|
|
5861
5867
|
visible: canViewPartners
|
|
5862
5868
|
}, {
|
|
@@ -5962,16 +5968,14 @@ const UserDropdownMenu = ({
|
|
|
5962
5968
|
userHelpers = {},
|
|
5963
5969
|
isDev = false,
|
|
5964
5970
|
theme = {},
|
|
5965
|
-
moduleInterfaceConfig = null
|
|
5971
|
+
moduleInterfaceConfig = null,
|
|
5972
|
+
dropdownItems = []
|
|
5966
5973
|
}) => {
|
|
5967
5974
|
const resizeContext = useResizeContext();
|
|
5968
5975
|
const {
|
|
5969
5976
|
windowWidth
|
|
5970
5977
|
} = resizeContext || {};
|
|
5971
|
-
const
|
|
5972
|
-
userIsAdmin
|
|
5973
|
-
} = userHelpers;
|
|
5974
|
-
const isAdmin = React.useMemo(() => userIsAdmin?.(user), [user, userIsAdmin]);
|
|
5978
|
+
const isAdmin = React.useMemo(() => userIsAdmin(user), [user]);
|
|
5975
5979
|
|
|
5976
5980
|
// Add fallback for windowWidth
|
|
5977
5981
|
const actualWidth = windowWidth || (typeof window !== 'undefined' ? window.innerWidth : 1920);
|
|
@@ -6029,7 +6033,8 @@ const UserDropdownMenu = ({
|
|
|
6029
6033
|
changeNotificationState: changeNotificationState,
|
|
6030
6034
|
appName: appName,
|
|
6031
6035
|
theme: theme,
|
|
6032
|
-
moduleInterfaceConfig: moduleInterfaceConfig
|
|
6036
|
+
moduleInterfaceConfig: moduleInterfaceConfig,
|
|
6037
|
+
dropdownItems: dropdownItems
|
|
6033
6038
|
})]
|
|
6034
6039
|
}) : /*#__PURE__*/jsxRuntime.jsx(antd.Dropdown, {
|
|
6035
6040
|
trigger: "click",
|
|
@@ -6047,7 +6052,25 @@ const UserDropdownMenu = ({
|
|
|
6047
6052
|
})]
|
|
6048
6053
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
6049
6054
|
className: "list",
|
|
6050
|
-
children: [
|
|
6055
|
+
children: [dropdownItems && dropdownItems.filter(item => {
|
|
6056
|
+
if (typeof item.condition === 'function') {
|
|
6057
|
+
return item.condition({
|
|
6058
|
+
user,
|
|
6059
|
+
isAdmin,
|
|
6060
|
+
module,
|
|
6061
|
+
checkPermission,
|
|
6062
|
+
appName
|
|
6063
|
+
});
|
|
6064
|
+
}
|
|
6065
|
+
if ('condition' in item) {
|
|
6066
|
+
return !!item.condition;
|
|
6067
|
+
}
|
|
6068
|
+
return true;
|
|
6069
|
+
}).map(item => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6070
|
+
className: "list-item",
|
|
6071
|
+
onClick: () => handlegoTo(getRedirectLink(item.path)),
|
|
6072
|
+
children: item.name
|
|
6073
|
+
}, item.key)), user.company && !isDemoEnv && canViewUsers && !isAdmin ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
6051
6074
|
className: "list-item",
|
|
6052
6075
|
onClick: () => handlegoTo(getRedirectLink(`/app/users`)),
|
|
6053
6076
|
children: t('Users')
|
|
@@ -7905,6 +7928,7 @@ function AppLayout({
|
|
|
7905
7928
|
updateLanguage,
|
|
7906
7929
|
getUserOptions,
|
|
7907
7930
|
selectedProject,
|
|
7931
|
+
dropdownItems = [],
|
|
7908
7932
|
// Navigation (injected from app)
|
|
7909
7933
|
goTo = () => {},
|
|
7910
7934
|
location,
|
|
@@ -8233,7 +8257,8 @@ function AppLayout({
|
|
|
8233
8257
|
userHelpers: userHelpers,
|
|
8234
8258
|
isDev: isDev,
|
|
8235
8259
|
theme: theme,
|
|
8236
|
-
moduleInterfaceConfig: moduleInterfaceConfig
|
|
8260
|
+
moduleInterfaceConfig: moduleInterfaceConfig,
|
|
8261
|
+
dropdownItems: dropdownItems
|
|
8237
8262
|
})
|
|
8238
8263
|
})]
|
|
8239
8264
|
})]
|