datastake-daf 0.6.758 → 0.6.760
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 +2355 -2056
- package/dist/constants/index.js +51 -1
- package/dist/layouts/index.js +476 -452
- package/dist/pages/index.js +881 -885
- package/dist/services/index.js +91 -0
- package/dist/utils/index.js +523 -456
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Map/Map.stories.js +8 -0
- package/src/@daf/core/components/Dashboard/Map/helper.js +134 -3
- package/src/@daf/core/components/Dashboard/Map/hook.js +4 -0
- package/src/@daf/core/components/Dashboard/Map/index.jsx +19 -0
- package/src/@daf/core/components/Dashboard/Map/storyConfig.js +2 -1
- package/src/@daf/core/components/Dashboard/Map/storyConfig6.js +69 -0
- package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/config.js +2 -5
- package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/index.jsx +1 -1
- package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +1 -1
- package/src/@daf/core/components/Icon/configs/SpacingHeight.js +8 -0
- package/src/@daf/core/components/Icon/configs/SpacingWidth.js +8 -0
- package/src/@daf/core/components/Icon/configs/index.js +5 -1
- package/src/@daf/core/components/Screens/FindInformation/index.js +2 -1
- package/src/@daf/core/components/Screens/Users/columns.js +0 -6
- package/src/@daf/core/components/Table/NavigationAction/index.jsx +24 -0
- package/src/@daf/hooks/useMapHelper.js +15 -1
- package/src/@daf/pages/Documents/columns.js +5 -22
- package/src/@daf/pages/Events/Activities/columns.js +7 -59
- package/src/@daf/pages/Events/Incidents/columns.js +7 -61
- package/src/@daf/pages/Events/columns.js +6 -47
- package/src/@daf/pages/Events/helper.js +14 -0
- package/src/@daf/pages/Locations/MineSite/columns.js +1 -8
- package/src/@daf/pages/Locations/columns.js +6 -32
- package/src/@daf/pages/Partners/index.jsx +11 -0
- package/src/@daf/pages/Stakeholders/Operators/columns.js +2 -8
- package/src/@daf/pages/Stakeholders/Workers/columns.js +10 -49
- package/src/@daf/pages/Stakeholders/columns.js +4 -25
- package/src/@daf/pages/Summary/Activities/Restoration/helper.js +133 -79
- package/src/@daf/pages/Summary/Activities/Restoration/index.jsx +57 -60
- package/src/@daf/pages/Summary/Minesite/components/LocationMap/index.js +0 -1
- package/src/@daf/services/PartnerService.js +76 -0
- package/src/@daf/utils/tags.js +26 -0
- package/src/@daf/utils/tooltip.js +5 -2
- package/src/constants/breadCrumbs.js +2 -0
- package/src/constants.js +2 -1
- package/src/index.js +1 -1
- package/src/services.js +2 -1
- package/src/utils.js +3 -1
package/package.json
CHANGED
|
@@ -20,6 +20,8 @@ export function useMapHelper({
|
|
|
20
20
|
mapCenter,
|
|
21
21
|
allData,
|
|
22
22
|
renderTooltip,
|
|
23
|
+
renderTooltipForLocation = null,
|
|
24
|
+
renderTooltipForTerritory = null,
|
|
23
25
|
renderTooltipTags,
|
|
24
26
|
onClickLink,
|
|
25
27
|
link,
|
|
@@ -212,10 +214,139 @@ export function useMapHelper({
|
|
|
212
214
|
this.setStyle({ fillOpacity: 0.7 });
|
|
213
215
|
});
|
|
214
216
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
+
marker.on("popupclose", function () {
|
|
218
|
+
this.setStyle({ fillOpacity: 0.4 });
|
|
219
|
+
});
|
|
220
|
+
} else if (type === "location-territory" || type === "territory-location") {
|
|
221
|
+
const territoryTooltip = renderTooltipForTerritory || renderTooltip;
|
|
222
|
+
const locationTooltip = renderTooltipForLocation || renderTooltip;
|
|
223
|
+
|
|
224
|
+
let polygonMarker = null;
|
|
225
|
+
if (data.area && Array.isArray(data.area) && data.area.length >= 3) {
|
|
226
|
+
// Validate area coordinates are valid arrays with numeric values
|
|
227
|
+
const validArea = data.area.filter(coord => {
|
|
228
|
+
if (!Array.isArray(coord) || coord.length < 2) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
const lat = typeof coord[0] === 'number' ? coord[0] : parseFloat(coord[0]);
|
|
232
|
+
const lng = typeof coord[1] === 'number' ? coord[1] : parseFloat(coord[1]);
|
|
233
|
+
return !isNaN(lat) && !isNaN(lng) && isFinite(lat) && isFinite(lng);
|
|
217
234
|
});
|
|
218
|
-
|
|
235
|
+
|
|
236
|
+
if (validArea && validArea.length >= 3) {
|
|
237
|
+
polygonMarker = L.polygon(validArea, {
|
|
238
|
+
color: data.color,
|
|
239
|
+
opacity: 0.4,
|
|
240
|
+
}).addTo(mapRef);
|
|
241
|
+
|
|
242
|
+
const territoryDiv = document.createElement("div");
|
|
243
|
+
const territoryRoot = createRoot(territoryDiv);
|
|
244
|
+
|
|
245
|
+
const territoryTitle = data.territoryTitle || data.name;
|
|
246
|
+
|
|
247
|
+
territoryRoot.render(
|
|
248
|
+
<>
|
|
249
|
+
{renderTooltipHtml({
|
|
250
|
+
title: territoryTitle,
|
|
251
|
+
subTitle: data?.subTitle || data.type,
|
|
252
|
+
items: territoryTooltip(data),
|
|
253
|
+
tags: renderTooltipTags(data),
|
|
254
|
+
link,
|
|
255
|
+
total: data.sources,
|
|
256
|
+
onClickLink: () => onClickLink(data),
|
|
257
|
+
})}
|
|
258
|
+
</>,
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
roots.current.push(territoryRoot);
|
|
262
|
+
|
|
263
|
+
// Bind popup to polygon
|
|
264
|
+
polygonMarker.bindPopup(territoryDiv);
|
|
265
|
+
|
|
266
|
+
// Polygon hover effects
|
|
267
|
+
polygonMarker.on("popupopen", function () {
|
|
268
|
+
this.setStyle({ fillOpacity: 0.7 });
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
polygonMarker.on("popupclose", function () {
|
|
272
|
+
this.setStyle({ fillOpacity: 0.4 });
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
let locationMarker = null;
|
|
278
|
+
if (coordinates && coordinates[0] && coordinates[1]) {
|
|
279
|
+
let markerLat = typeof coordinates[0] === 'number' ? coordinates[0] : parseFloat(coordinates[0]);
|
|
280
|
+
let markerLng = typeof coordinates[1] === 'number' ? coordinates[1] : parseFloat(coordinates[1]);
|
|
281
|
+
|
|
282
|
+
if ((markerLat < -90 || markerLat > 90) && (markerLng >= -90 && markerLng <= 90)) {
|
|
283
|
+
const temp = markerLat;
|
|
284
|
+
markerLat = markerLng;
|
|
285
|
+
markerLng = temp;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (!isNaN(markerLat) && !isNaN(markerLng) && isFinite(markerLat) && isFinite(markerLng) &&
|
|
289
|
+
markerLat >= -90 && markerLat <= 90 && markerLng >= -180 && markerLng <= 180) {
|
|
290
|
+
const markerCoordinates = [markerLat, markerLng];
|
|
291
|
+
|
|
292
|
+
iconClassName = "";
|
|
293
|
+
const markerFillColor = data.markerColor || "var(--color-primary-60)";
|
|
294
|
+
innerHtml = `
|
|
295
|
+
|
|
296
|
+
<svg
|
|
297
|
+
width="28"
|
|
298
|
+
height="33"
|
|
299
|
+
viewBox="0 0 28 33"
|
|
300
|
+
fill="none"
|
|
301
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
302
|
+
>
|
|
303
|
+
<path
|
|
304
|
+
d="M5.14346 4.87419C10.0688 -0.15896 18.0528 -0.162058 22.9757 4.86861C27.6563 9.65161 27.8841 17.2616 23.6622 22.3255H23.6608C23.427 22.6141 23.1808 22.894 22.9211 23.1623L14.0671 32.2101L5.44057 23.3948L5.13868 23.096C0.215857 18.0655 0.218422 9.90737 5.14346 4.87419Z"
|
|
305
|
+
fill="${markerFillColor}"
|
|
306
|
+
stroke="white"
|
|
307
|
+
/>
|
|
308
|
+
</svg>
|
|
309
|
+
|
|
310
|
+
`;
|
|
311
|
+
|
|
312
|
+
const locationDiv = document.createElement("div");
|
|
313
|
+
const locationRoot = createRoot(locationDiv);
|
|
314
|
+
|
|
315
|
+
locationRoot.render(
|
|
316
|
+
<>
|
|
317
|
+
{renderTooltipHtml({
|
|
318
|
+
title: data.name,
|
|
319
|
+
subTitle: data?.subTitle || data.type,
|
|
320
|
+
items: locationTooltip(data),
|
|
321
|
+
tags: renderTooltipTags(data),
|
|
322
|
+
link: false,
|
|
323
|
+
total: data.sources,
|
|
324
|
+
onClickLink: () => onClickLink(data),
|
|
325
|
+
})}
|
|
326
|
+
</>,
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
roots.current.push(locationRoot);
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
locationMarker = addIconToMap(
|
|
333
|
+
markerCoordinates,
|
|
334
|
+
iconClassName,
|
|
335
|
+
data,
|
|
336
|
+
tooltipAsText ? data.name : locationDiv,
|
|
337
|
+
iconSize,
|
|
338
|
+
innerHtml,
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
if (locationMarker) {
|
|
342
|
+
locationMarker.setZIndexOffset(1000);
|
|
343
|
+
locationMarker.bindPopup(locationDiv);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
marker = polygonMarker || locationMarker;
|
|
349
|
+
} else if (type === "stakeholder") {
|
|
219
350
|
marker = L.marker(coordinates, {
|
|
220
351
|
icon: L.divIcon({
|
|
221
352
|
html: `<div id="${i}"></div>`,
|
|
@@ -18,6 +18,8 @@ export const useMap = ({
|
|
|
18
18
|
polygon,
|
|
19
19
|
app,
|
|
20
20
|
renderTooltip,
|
|
21
|
+
renderTooltipForLocation = null,
|
|
22
|
+
renderTooltipForTerritory = null,
|
|
21
23
|
renderTooltipTags,
|
|
22
24
|
mapConfig,
|
|
23
25
|
tooltipAsText,
|
|
@@ -137,6 +139,8 @@ export const useMap = ({
|
|
|
137
139
|
allData,
|
|
138
140
|
mapCenter,
|
|
139
141
|
renderTooltip,
|
|
142
|
+
renderTooltipForLocation,
|
|
143
|
+
renderTooltipForTerritory,
|
|
140
144
|
renderTooltipTags,
|
|
141
145
|
onClickLink,
|
|
142
146
|
link,
|
|
@@ -48,6 +48,16 @@ import Filters from "../../Filters/FloatingFilters/index.js";
|
|
|
48
48
|
* Custom renderer for tooltip content.
|
|
49
49
|
* Signature: `(dataItem) => ReactNode | string`
|
|
50
50
|
*
|
|
51
|
+
* - `renderTooltipForLocation` (function, optional):
|
|
52
|
+
* Custom renderer for location marker tooltips (used in location-territory type).
|
|
53
|
+
* Signature: `(dataItem) => Array`
|
|
54
|
+
* Falls back to `renderTooltip` if not provided.
|
|
55
|
+
*
|
|
56
|
+
* - `renderTooltipForTerritory` (function, optional):
|
|
57
|
+
* Custom renderer for territory polygon tooltips (used in location-territory type).
|
|
58
|
+
* Signature: `(dataItem) => Array`
|
|
59
|
+
* Falls back to `renderTooltip` if not provided.
|
|
60
|
+
*
|
|
51
61
|
* - `mapConfig` (object):
|
|
52
62
|
* Configuration object for the map's behavior, such as zoom levels, center, and controls.
|
|
53
63
|
*
|
|
@@ -102,6 +112,8 @@ function Map({
|
|
|
102
112
|
link,
|
|
103
113
|
siderTitle = "Mine Description",
|
|
104
114
|
renderTooltip = () => [],
|
|
115
|
+
renderTooltipForLocation = null,
|
|
116
|
+
renderTooltipForTerritory = null,
|
|
105
117
|
renderTooltipTags = () => {},
|
|
106
118
|
mapConfig = { maxZoom: 18, center: [13, -15], zoom: 5 },
|
|
107
119
|
emptyDescriptionText = "No description provided",
|
|
@@ -134,6 +146,8 @@ function Map({
|
|
|
134
146
|
t,
|
|
135
147
|
app,
|
|
136
148
|
renderTooltip,
|
|
149
|
+
renderTooltipForLocation,
|
|
150
|
+
renderTooltipForTerritory,
|
|
137
151
|
renderTooltipTags,
|
|
138
152
|
onClickLink,
|
|
139
153
|
link,
|
|
@@ -260,6 +274,11 @@ Map.propTypes = {
|
|
|
260
274
|
filtersConfig: PropTypes.any,
|
|
261
275
|
onFilterChange: PropTypes.any,
|
|
262
276
|
nameAsSiderTitle: PropTypes.bool,
|
|
277
|
+
renderTooltip: PropTypes.func,
|
|
278
|
+
renderTooltipForLocation: PropTypes.func,
|
|
279
|
+
renderTooltipForTerritory: PropTypes.func,
|
|
280
|
+
renderTooltipTags: PropTypes.func,
|
|
281
|
+
link: PropTypes.any,
|
|
263
282
|
};
|
|
264
283
|
|
|
265
284
|
export default Map;
|
|
@@ -3,5 +3,6 @@ import { storyConfig as DefaultMapConfig } from "./storyConfig2.js";
|
|
|
3
3
|
import { storyConfig as TerritoryMapConfig } from "./storyConfig3.js";
|
|
4
4
|
import { storyConfig as StakeholderMapConfig } from "./storyConfig4.js";
|
|
5
5
|
import { storyConfig as ChainMapConfig } from "./storyConfig5.js";
|
|
6
|
+
import { storyConfig as LocationTerritoryMapConfig } from "./storyConfig6.js";
|
|
6
7
|
|
|
7
|
-
export { DefaultMapConfig, TerritoryMapConfig, StakeholderMapConfig, EventConfig, ChainMapConfig };
|
|
8
|
+
export { DefaultMapConfig, TerritoryMapConfig, StakeholderMapConfig, EventConfig, ChainMapConfig, LocationTerritoryMapConfig };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export const storyConfig = {
|
|
2
|
+
data: [
|
|
3
|
+
{
|
|
4
|
+
_id: {},
|
|
5
|
+
id: "7f2aaed4-4b2e-406c-8e0a-6659c5c8367b",
|
|
6
|
+
color: "#6698E4",
|
|
7
|
+
gps: {
|
|
8
|
+
latitude: 7,
|
|
9
|
+
longitude: 1,
|
|
10
|
+
},
|
|
11
|
+
area: [
|
|
12
|
+
[6, 5],
|
|
13
|
+
[7, 1],
|
|
14
|
+
[9, 2],
|
|
15
|
+
[8, 4],
|
|
16
|
+
],
|
|
17
|
+
name: "Territory with Location - Area 1",
|
|
18
|
+
subTitle: "Mine Site",
|
|
19
|
+
type: "Territory Type",
|
|
20
|
+
datastakeId: "LOC-00000000141",
|
|
21
|
+
sources: 2,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
_id: {},
|
|
25
|
+
id: "7f2aaed4-4b2e-406c-8e0a-6659c5c8368c",
|
|
26
|
+
color: "#D3ADF7",
|
|
27
|
+
gps: {
|
|
28
|
+
latitude: 8,
|
|
29
|
+
longitude: 2,
|
|
30
|
+
},
|
|
31
|
+
area: [
|
|
32
|
+
[7, 6],
|
|
33
|
+
[8, 2],
|
|
34
|
+
[10, 13],
|
|
35
|
+
[9, 8],
|
|
36
|
+
],
|
|
37
|
+
name: "Territory with Location - Area 2",
|
|
38
|
+
subTitle: "Processing Site",
|
|
39
|
+
type: "Territory Type",
|
|
40
|
+
datastakeId: "LOC-00000000142",
|
|
41
|
+
sources: 1,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
// tooltipAsText: true,
|
|
45
|
+
primaryLink: true,
|
|
46
|
+
renderTooltip: (data) => {
|
|
47
|
+
return [
|
|
48
|
+
{
|
|
49
|
+
label: "Location",
|
|
50
|
+
value: data.name || "--",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: "Type",
|
|
54
|
+
value: data.subTitle || data.type || "--",
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
},
|
|
58
|
+
renderTooltipTags: () => {
|
|
59
|
+
return {
|
|
60
|
+
label: "Category",
|
|
61
|
+
items: [{ label: "Active", color: "blue" }, { label: "Monitored" }],
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
link: true,
|
|
65
|
+
onClickLink: (data) => {
|
|
66
|
+
console.log(data);
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
@@ -53,11 +53,8 @@ export const getActivityIndicatorsConfig = ({ t, data = {}, onRemove }) => {
|
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
icon: "User",
|
|
56
|
-
label: t("
|
|
57
|
-
|
|
58
|
-
type: data?.childrenPresence === true ? "notCompliant" :
|
|
59
|
-
data?.childrenPresence === false ? "compliant" :
|
|
60
|
-
"empty",
|
|
56
|
+
label: t("No children"),
|
|
57
|
+
type: getType(data?.childrenPresence),
|
|
61
58
|
onClick: getOnClick("childrenPresence"),
|
|
62
59
|
},
|
|
63
60
|
{
|
|
@@ -18,7 +18,7 @@ export default function KeyIndicatorsWidget({
|
|
|
18
18
|
const component = (
|
|
19
19
|
<Widget
|
|
20
20
|
loading={loading}
|
|
21
|
-
className={formatClassname(["flex-1 with-border-header", widgetClassName])}
|
|
21
|
+
className={formatClassname(["flex-1 h-w-btn-header with-border-header", widgetClassName])}
|
|
22
22
|
title={noTitle ? undefined : t(title)}
|
|
23
23
|
noTitle={noTitle}
|
|
24
24
|
>
|
|
@@ -86,7 +86,7 @@ const BaseGraph = forwardRef(function BaseGraph(
|
|
|
86
86
|
fitView={true} // zoom out on default
|
|
87
87
|
fitViewOptions={{
|
|
88
88
|
padding: 0.2, //zoom out on default
|
|
89
|
-
duration: withDuration ? 300 : undefined,
|
|
89
|
+
// duration: withDuration ? 300 : undefined,
|
|
90
90
|
}}
|
|
91
91
|
{...props}
|
|
92
92
|
>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
viewBox: "0 0 12 12",
|
|
3
|
+
children: (
|
|
4
|
+
<path d="M5.6875 9.1875L5.6875 2.1875M5.6875 9.1875L3.9375 8.02083M5.6875 9.1875L7.4375 8.02083M5.6875 2.1875L3.9375 3.35417M5.6875 2.1875L7.4375 3.35417M10.9375 0.4375H0.4375M10.9375 10.9375H0.4375" stroke="currentColor" strokeWidth="0.875" strokeLinecap="round" strokeLinejoin="round"/>
|
|
5
|
+
),
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default config;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
viewBox: "0 0 12 12",
|
|
3
|
+
children: (
|
|
4
|
+
<path d="M2.1875 5.6875H9.1875M2.1875 5.6875L3.35417 3.9375M2.1875 5.6875L3.35417 7.4375M9.1875 5.6875L8.02083 3.9375M9.1875 5.6875L8.02083 7.4375M10.9375 10.9375V0.437501M0.4375 10.9375V0.4375" stroke="currentColor" strokeWidth="0.875" strokeLinecap="round" strokeLinejoin="round"/>
|
|
5
|
+
),
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default config;
|
|
@@ -223,7 +223,9 @@ import Bear from "./Bear";
|
|
|
223
223
|
import Security from "./Security";
|
|
224
224
|
import Minus from "./Minus";
|
|
225
225
|
import ClockPlus from "./ClockPlus";
|
|
226
|
-
import WaziDarkIcon from "./WaziDarkIcon";
|
|
226
|
+
import WaziDarkIcon from "./WaziDarkIcon";
|
|
227
|
+
import SpacingHeight from "./SpacingHeight";
|
|
228
|
+
import SpacingWidth from "./SpacingWidth";
|
|
227
229
|
|
|
228
230
|
const config = {
|
|
229
231
|
AppAdmin,
|
|
@@ -452,6 +454,8 @@ const config = {
|
|
|
452
454
|
Minus,
|
|
453
455
|
ClockPlus,
|
|
454
456
|
WaziDarkIcon,
|
|
457
|
+
SpacingHeight,
|
|
458
|
+
SpacingWidth,
|
|
455
459
|
};
|
|
456
460
|
|
|
457
461
|
export default config;
|
|
@@ -18,6 +18,7 @@ export default function FindInformation({
|
|
|
18
18
|
goTo = () => {},
|
|
19
19
|
getRedirectLink = () => {},
|
|
20
20
|
renderBreadCrumbs = () => {},
|
|
21
|
+
breadcrumbs = [],
|
|
21
22
|
}) {
|
|
22
23
|
const { defaultTab, setDefaultTab } = useFindInformation();
|
|
23
24
|
const params = useMemo(() => new URLSearchParams(location.search), [location.search]);
|
|
@@ -41,7 +42,7 @@ export default function FindInformation({
|
|
|
41
42
|
return (
|
|
42
43
|
<div className="daf-create-view semibold form-input-output">
|
|
43
44
|
<Header
|
|
44
|
-
breadcrumbs={breadCrumbs}
|
|
45
|
+
breadcrumbs={breadcrumbs || breadCrumbs}
|
|
45
46
|
title={t("Find Information")}
|
|
46
47
|
supportText={t(
|
|
47
48
|
"Identify available information sources among users of compatible applications and connected databases.",
|
|
@@ -3,12 +3,6 @@ import { Modal, Tag, Typography, message ,Tooltip} from "antd";
|
|
|
3
3
|
|
|
4
4
|
import { renderDateFormatted } from '../../../../../helpers/Forms.js';
|
|
5
5
|
import MoreMenu from '../../../../core/components/Table/MoreMenu/index.jsx';
|
|
6
|
-
const getLinkValue = (value, linkingObject) => {
|
|
7
|
-
if(linkingObject && linkingObject?.[value]) {
|
|
8
|
-
return linkingObject?.[value]?.name;
|
|
9
|
-
}
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
6
|
|
|
13
7
|
export const getColumns = ({t, goTo, user, removeUser = () => {},
|
|
14
8
|
resendInvite = () => {},
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import CustomIcon from '../../Icon/CustomIcon.jsx';
|
|
3
|
+
|
|
4
|
+
const NavigationAction = ({onClick, theme}) => {
|
|
5
|
+
return (
|
|
6
|
+
<div style={{ display: "flex", justifyContent: "center" }}>
|
|
7
|
+
<button
|
|
8
|
+
onClick={onClick}
|
|
9
|
+
style={{
|
|
10
|
+
cursor: 'pointer',
|
|
11
|
+
border: 'none',
|
|
12
|
+
background: 'transparent',
|
|
13
|
+
padding: 0,
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'center'
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<CustomIcon name="Link" size={15} color={theme.baseGray70} />
|
|
19
|
+
</button>
|
|
20
|
+
</div>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default NavigationAction
|
|
@@ -15,9 +15,23 @@ export const filterValidGPS = (data) => {
|
|
|
15
15
|
const latCheck = (lat) => lat > -90 || lat < 90;
|
|
16
16
|
const lngCheck = (lng) => lng > -180 || lng < 180;
|
|
17
17
|
return data.filter(item => {
|
|
18
|
-
|
|
18
|
+
// Check if item has valid GPS coordinates
|
|
19
|
+
const hasValidGPS = item.marker &&
|
|
19
20
|
latCheck(Number(item.marker.lat)) &&
|
|
20
21
|
lngCheck(Number(item.marker.lng));
|
|
22
|
+
|
|
23
|
+
const hasValidArea = item.area &&
|
|
24
|
+
Array.isArray(item.area) &&
|
|
25
|
+
item.area.length >= 3 &&
|
|
26
|
+
item.area.every(coord =>
|
|
27
|
+
Array.isArray(coord) &&
|
|
28
|
+
coord.length >= 2 &&
|
|
29
|
+
!isNaN(coord[0]) && !isNaN(coord[1]) &&
|
|
30
|
+
isFinite(coord[0]) && isFinite(coord[1])
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
// Include item if it has either valid GPS or valid area
|
|
34
|
+
return hasValidGPS || hasValidArea;
|
|
21
35
|
});
|
|
22
36
|
}
|
|
23
37
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Tooltip } from 'antd';
|
|
3
|
-
import { findOptions } from '../../../helpers/StringHelper.js';
|
|
4
3
|
import { renderDateFormatted } from '../../../helpers/Forms.js';
|
|
5
|
-
import CustomIcon from '../../core/components/Icon/CustomIcon.jsx';
|
|
6
4
|
import AvatarGroup from '../../core/components/AvatarGroup/index.jsx';
|
|
7
5
|
import sourceAvatarConfig from '../../../helpers/sourceAvatarConfig.js';
|
|
8
|
-
import
|
|
6
|
+
import NavigationAction from '../../core/components/Table/NavigationAction/index.jsx';
|
|
7
|
+
|
|
9
8
|
export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink, theme, subject, applications }) => [
|
|
10
9
|
{
|
|
11
10
|
dataIndex: 'datastakeId',
|
|
@@ -88,30 +87,14 @@ export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
88
87
|
return <div className="daf-default-cell" />;
|
|
89
88
|
}
|
|
90
89
|
const onClick = () => {
|
|
91
|
-
|
|
90
|
+
let link = `/app/view/${subject}/${all.datastakeId}`;
|
|
92
91
|
if (activeTab === "shared") {
|
|
93
92
|
link += `?sourceId=${all?.authorId?.id}`;
|
|
94
93
|
}
|
|
95
94
|
goTo(getRedirectLink(link));
|
|
96
95
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
label: t("Details"),
|
|
100
|
-
value: "details",
|
|
101
|
-
onClick: onClick,
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
label: t("Remove"),
|
|
105
|
-
value: "remove",
|
|
106
|
-
onClick: () => {
|
|
107
|
-
console.log("remove");
|
|
108
|
-
},
|
|
109
|
-
disabled: true,
|
|
110
|
-
},
|
|
111
|
-
];
|
|
112
|
-
return <div >
|
|
113
|
-
<MoreMenu items={moreMenuItems} />
|
|
114
|
-
</div>;
|
|
96
|
+
|
|
97
|
+
return <NavigationAction onClick={onClick} theme={theme} />;
|
|
115
98
|
}
|
|
116
99
|
}
|
|
117
100
|
].filter((column) => column.show !== false);
|
|
@@ -1,55 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Tooltip, Tag } from 'antd';
|
|
3
|
-
import { findOptions } from '../../../../helpers/StringHelper.js';
|
|
3
|
+
import { findOptions, getLinkValue } from '../../../../helpers/StringHelper.js';
|
|
4
4
|
import { renderDateFormatted } from '../../../../helpers/Forms.js';
|
|
5
|
-
import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
|
|
6
5
|
import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
|
|
7
6
|
import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return linkingObject?.[value]?.name;
|
|
12
|
-
}
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const getEventCategoryBySubject = (eventCategoryObject, subject) => {
|
|
17
|
-
if (!eventCategoryObject || typeof eventCategoryObject !== 'object') {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const subjectSingular = subject.endsWith('ies')
|
|
22
|
-
? subject.slice(0, -3) + 'y'
|
|
23
|
-
: subject;
|
|
24
|
-
|
|
25
|
-
const key = `typeOfEvent is ${subjectSingular}`;
|
|
26
|
-
return eventCategoryObject[key] || null;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const renderStatusTag = ({ value, t = (s) => s }) => {
|
|
30
|
-
const width = 87;
|
|
31
|
-
|
|
32
|
-
switch (value) {
|
|
33
|
-
case "edited":
|
|
34
|
-
return (
|
|
35
|
-
<Tag color="yellow" style={{ width }} className="text-center">
|
|
36
|
-
{t("Edited")}
|
|
37
|
-
</Tag>
|
|
38
|
-
);
|
|
39
|
-
case "submitted":
|
|
40
|
-
return (
|
|
41
|
-
<Tag color="green" style={{ width }} className="text-center">
|
|
42
|
-
{t("Submitted")}
|
|
43
|
-
</Tag>
|
|
44
|
-
);
|
|
45
|
-
default:
|
|
46
|
-
return (
|
|
47
|
-
<Tag color="blue" style={{ width }} className="text-center">
|
|
48
|
-
{t("Private")}
|
|
49
|
-
</Tag>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
7
|
+
import { getEventCategoryBySubject } from '../helper.js';
|
|
8
|
+
import { renderStatusTag } from '../../../utils/tags.js';
|
|
9
|
+
import NavigationAction from '../../../core/components/Table/NavigationAction/index.jsx';
|
|
53
10
|
|
|
54
11
|
export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
|
|
55
12
|
{
|
|
@@ -210,23 +167,14 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
210
167
|
return <div className="daf-default-cell" />;
|
|
211
168
|
}
|
|
212
169
|
const onClick = () => {
|
|
213
|
-
|
|
170
|
+
let link = `/app/view/${subject}/${all.datastakeId}`;
|
|
214
171
|
if (activeTab === "shared") {
|
|
215
172
|
link += `?sourceId=${all?.authorId?.id}`;
|
|
216
173
|
}
|
|
217
174
|
goTo(getRedirectLink(link));
|
|
218
175
|
};
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
label: t("Details"),
|
|
222
|
-
value: "details",
|
|
223
|
-
onClick: onClick,
|
|
224
|
-
},
|
|
225
|
-
|
|
226
|
-
];
|
|
227
|
-
return <div >
|
|
228
|
-
<MoreMenu items={moreMenuItems} />
|
|
229
|
-
</div>;
|
|
176
|
+
|
|
177
|
+
return <NavigationAction onClick={onClick} theme={theme} />;
|
|
230
178
|
}
|
|
231
179
|
}
|
|
232
180
|
].filter((column) => column.show !== false);
|