datastake-daf 0.6.838 → 0.6.840
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 +1578 -1443
- package/dist/pages/index.js +80 -33
- package/dist/utils/index.js +4 -0
- package/package.json +1 -1
- package/src/@daf/hooks/useTimeFilter.js +1 -1
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/ProblemSolver/index.js +1 -1
- package/src/@daf/pages/Dashboards/SelfAssesment/components/ProductionSites/index.jsx +2 -1
- package/src/@daf/pages/Dashboards/SelfAssesment/index.jsx +3 -2
- package/src/@daf/pages/ResetPassword/index.jsx +228 -0
- package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CommunityParticipation/JobsTimeline/index.jsx +7 -15
- package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CycleOutcomes/PlantingActivitiesTimeline.jsx +6 -0
- package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CycleOutcomes/RestoredArea.jsx +1 -0
- package/src/@daf/pages/Summary/Operator/components/Governance/config.js +1 -1
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/helper.js +1 -0
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +10 -6
- package/src/@daf/utils/timeFilterUtils.js +43 -14
- package/src/constants/locales/en/translation.js +2 -0
- package/src/constants/locales/fr/translation.js +1 -0
- package/src/constants/locales/sp/translation.js +1 -0
- package/src/index.js +6 -1
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
- package/dist/style/datastake/mapbox-gl.css +0 -330
package/dist/pages/index.js
CHANGED
|
@@ -16580,7 +16580,8 @@ function ProductionSites({
|
|
|
16580
16580
|
goTo = () => {},
|
|
16581
16581
|
getRedirectLink = () => {},
|
|
16582
16582
|
data = [],
|
|
16583
|
-
loading = false
|
|
16583
|
+
loading = false,
|
|
16584
|
+
APP
|
|
16584
16585
|
}) {
|
|
16585
16586
|
const productionSites = React.useMemo(() => {
|
|
16586
16587
|
if (Array.isArray(data?.productionSites)) {
|
|
@@ -16601,7 +16602,7 @@ function ProductionSites({
|
|
|
16601
16602
|
});
|
|
16602
16603
|
}, [t, options, user, goTo, getRedirectLink]);
|
|
16603
16604
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
16604
|
-
title: t("
|
|
16605
|
+
title: t(APP === 'wazi' ? "Operating Sites" : "Production Site"),
|
|
16605
16606
|
className: "with-border-header no-px-body",
|
|
16606
16607
|
loading: loading,
|
|
16607
16608
|
children: /*#__PURE__*/jsxRuntime.jsx(Wrapper, {
|
|
@@ -17183,7 +17184,8 @@ function SelfAssesment({
|
|
|
17183
17184
|
theme = {},
|
|
17184
17185
|
options = {},
|
|
17185
17186
|
data,
|
|
17186
|
-
loading
|
|
17187
|
+
loading,
|
|
17188
|
+
APP
|
|
17187
17189
|
}) {
|
|
17188
17190
|
return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
|
|
17189
17191
|
header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
|
|
@@ -17208,7 +17210,8 @@ function SelfAssesment({
|
|
|
17208
17210
|
goTo: goTo,
|
|
17209
17211
|
getRedirectLink: getRedirectLink,
|
|
17210
17212
|
data: data,
|
|
17211
|
-
loading: loading
|
|
17213
|
+
loading: loading,
|
|
17214
|
+
APP: APP
|
|
17212
17215
|
})
|
|
17213
17216
|
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
17214
17217
|
children: /*#__PURE__*/jsxRuntime.jsx(AssociatedInformation$1, {
|
|
@@ -46600,6 +46603,7 @@ const mapItem = (data, options, goTo, getRedirectLink, operatorData = {}, APP) =
|
|
|
46600
46603
|
value: data.country || operatorData?.country
|
|
46601
46604
|
},
|
|
46602
46605
|
totalSources: data.sources ?? 0,
|
|
46606
|
+
product: data?.product || "",
|
|
46603
46607
|
volume: data?.volume || "",
|
|
46604
46608
|
onClick: function () {
|
|
46605
46609
|
if (data.type === "mineSite") {
|
|
@@ -47113,6 +47117,9 @@ const TradeRelationships = ({
|
|
|
47113
47117
|
return c.totalSources || 0;
|
|
47114
47118
|
},
|
|
47115
47119
|
renderTooltipItems: data => [{
|
|
47120
|
+
label: "Product",
|
|
47121
|
+
value: data?.product || "--"
|
|
47122
|
+
}, {
|
|
47116
47123
|
label: "Volume",
|
|
47117
47124
|
value: data?.volume || "--"
|
|
47118
47125
|
}],
|
|
@@ -47151,7 +47158,7 @@ const IconNodesConfig$1 = {
|
|
|
47151
47158
|
emptyName: "no-management"
|
|
47152
47159
|
},
|
|
47153
47160
|
shareholders: {
|
|
47154
|
-
name: "
|
|
47161
|
+
name: "Shareholders",
|
|
47155
47162
|
icon: "PercentCircle",
|
|
47156
47163
|
order: 4,
|
|
47157
47164
|
emptyName: "no-stakeholders"
|
|
@@ -55693,7 +55700,7 @@ const PlantingLocations = ({
|
|
|
55693
55700
|
* Formats a date based on the time filter
|
|
55694
55701
|
* @param {dayjs.Dayjs} date - The date to format
|
|
55695
55702
|
* @param {boolean} breakLine - Whether to add a line break (for tooltips)
|
|
55696
|
-
* @param {string} timeFilter - The time filter ('daily', 'weekly', 'monthly')
|
|
55703
|
+
* @param {string} timeFilter - The time filter ('daily', 'weekly', 'monthly', 'yearly')
|
|
55697
55704
|
* @returns {string} Formatted date string
|
|
55698
55705
|
*/
|
|
55699
55706
|
const getFormatDate = (date, breakLine = false, timeFilter = 'monthly') => {
|
|
@@ -55702,20 +55709,30 @@ const getFormatDate = (date, breakLine = false, timeFilter = 'monthly') => {
|
|
|
55702
55709
|
return date.format("DD/MM");
|
|
55703
55710
|
case "weekly":
|
|
55704
55711
|
return `W${renderNumber$1(date.week())}`;
|
|
55712
|
+
case "yearly":
|
|
55713
|
+
return date.format("YYYY");
|
|
55705
55714
|
default:
|
|
55706
55715
|
// Monthly format: "Dec 24", "Jan 25", etc.
|
|
55707
|
-
|
|
55708
55716
|
return breakLine ? `${capitalize(date.format("MMM"))}\n${date.format("YY")}` : `${capitalize(date.format("MMM"))} ${date.format("YY")}`;
|
|
55709
55717
|
}
|
|
55710
55718
|
};
|
|
55711
55719
|
|
|
55712
55720
|
/**
|
|
55713
55721
|
* Gets the time quantity string for dayjs operations
|
|
55714
|
-
* @param {string} timeFilter - The time filter ('daily', 'weekly', 'monthly')
|
|
55715
|
-
* @returns {string} Time quantity string ('days', 'weeks', 'months')
|
|
55722
|
+
* @param {string} timeFilter - The time filter ('daily', 'weekly', 'monthly', 'yearly')
|
|
55723
|
+
* @returns {string} Time quantity string ('days', 'weeks', 'months', 'years')
|
|
55716
55724
|
*/
|
|
55717
55725
|
const getTimeQuantity = (timeFilter = 'monthly') => {
|
|
55718
|
-
|
|
55726
|
+
switch (timeFilter) {
|
|
55727
|
+
case "daily":
|
|
55728
|
+
return "days";
|
|
55729
|
+
case "weekly":
|
|
55730
|
+
return "weeks";
|
|
55731
|
+
case "yearly":
|
|
55732
|
+
return "years";
|
|
55733
|
+
default:
|
|
55734
|
+
return "months";
|
|
55735
|
+
}
|
|
55719
55736
|
};
|
|
55720
55737
|
|
|
55721
55738
|
/**
|
|
@@ -55741,6 +55758,9 @@ const getPreviousGraphData = (dates, startDate, timeFilter, valueField = 'total'
|
|
|
55741
55758
|
case "weekly":
|
|
55742
55759
|
isBeforeStart = date.isBefore(startDate, 'week');
|
|
55743
55760
|
break;
|
|
55761
|
+
case "yearly":
|
|
55762
|
+
isBeforeStart = date.isBefore(startDate, 'year');
|
|
55763
|
+
break;
|
|
55744
55764
|
default:
|
|
55745
55765
|
isBeforeStart = date.isBefore(startDate, 'month');
|
|
55746
55766
|
break;
|
|
@@ -55763,7 +55783,7 @@ const getPreviousGraphData = (dates, startDate, timeFilter, valueField = 'total'
|
|
|
55763
55783
|
* Processes chart data with time filtering support
|
|
55764
55784
|
* @param {Object} params - Parameters object
|
|
55765
55785
|
* @param {Array} params.mainData - Array of data objects with date and value fields
|
|
55766
|
-
* @param {string} params.timeFilter - Time filter ('daily', 'weekly', 'monthly')
|
|
55786
|
+
* @param {string} params.timeFilter - Time filter ('daily', 'weekly', 'monthly', 'yearly')
|
|
55767
55787
|
* @param {Object} params.filters - Optional filters object with timeframe
|
|
55768
55788
|
* @param {boolean} params.isCumulative - Whether to calculate cumulative values (default: false)
|
|
55769
55789
|
* @param {string} params.valueField - Field name to extract value from (default: 'total', also checks 'count', 'jobs', 'value')
|
|
@@ -55790,6 +55810,9 @@ const processChartDateData = ({
|
|
|
55790
55810
|
} else if (filter === "weekly") {
|
|
55791
55811
|
start = start.startOf('week');
|
|
55792
55812
|
end = end.startOf('week');
|
|
55813
|
+
} else if (filter === "yearly") {
|
|
55814
|
+
start = start.startOf('year');
|
|
55815
|
+
end = end.startOf('year');
|
|
55793
55816
|
} else {
|
|
55794
55817
|
start = start.startOf('month');
|
|
55795
55818
|
end = end.startOf('month');
|
|
@@ -55806,9 +55829,24 @@ const processChartDateData = ({
|
|
|
55806
55829
|
cumulativeScore = hasPreviousData ? previousCumulativeScore : 0;
|
|
55807
55830
|
}
|
|
55808
55831
|
|
|
55832
|
+
// Get the period unit for comparison
|
|
55833
|
+
const getPeriodUnit = f => {
|
|
55834
|
+
switch (f) {
|
|
55835
|
+
case "daily":
|
|
55836
|
+
return "day";
|
|
55837
|
+
case "weekly":
|
|
55838
|
+
return "week";
|
|
55839
|
+
case "yearly":
|
|
55840
|
+
return "year";
|
|
55841
|
+
default:
|
|
55842
|
+
return "month";
|
|
55843
|
+
}
|
|
55844
|
+
};
|
|
55845
|
+
const periodUnit = getPeriodUnit(filter);
|
|
55846
|
+
|
|
55809
55847
|
// Loop until we reach the end date
|
|
55810
55848
|
let currentDate = start.clone();
|
|
55811
|
-
while (currentDate.isBefore(end) || currentDate.isSame(end,
|
|
55849
|
+
while (currentDate.isBefore(end) || currentDate.isSame(end, periodUnit)) {
|
|
55812
55850
|
// Filter data points that fall within this period
|
|
55813
55851
|
const score = isEmpty ? 0 : dates.filter(d => {
|
|
55814
55852
|
if (!d.date) return false;
|
|
@@ -55817,6 +55855,8 @@ const processChartDateData = ({
|
|
|
55817
55855
|
return d.date === currentDate.format("YYYY-MM-DD");
|
|
55818
55856
|
case "weekly":
|
|
55819
55857
|
return dayjs__default["default"](d.date, "YYYY-MM-DD").week() === currentDate.week() && dayjs__default["default"](d.date, "YYYY-MM-DD").year() === currentDate.year();
|
|
55858
|
+
case "yearly":
|
|
55859
|
+
return dayjs__default["default"](d.date, "YYYY-MM-DD").year() === currentDate.year();
|
|
55820
55860
|
default:
|
|
55821
55861
|
return dayjs__default["default"](d.date, "YYYY-MM-DD").format("YYYY-MM") === currentDate.format("YYYY-MM");
|
|
55822
55862
|
}
|
|
@@ -55853,7 +55893,7 @@ const processChartDateData = ({
|
|
|
55853
55893
|
const formatDateAxis = (label, getFormatDateFn) => {
|
|
55854
55894
|
if (!label) return label;
|
|
55855
55895
|
|
|
55856
|
-
// Check if label is already in the correct format (MMM YY, DD/MM, or
|
|
55896
|
+
// Check if label is already in the correct format (MMM YY, DD/MM, W#, or YYYY)
|
|
55857
55897
|
// If it matches our format patterns, return as-is
|
|
55858
55898
|
if (typeof label === 'string') {
|
|
55859
55899
|
// Check for MMM YY format (e.g., "Dec 24", "Jan 25")
|
|
@@ -55868,6 +55908,10 @@ const formatDateAxis = (label, getFormatDateFn) => {
|
|
|
55868
55908
|
if (/^W\d+$/.test(label)) {
|
|
55869
55909
|
return label;
|
|
55870
55910
|
}
|
|
55911
|
+
// Check for YYYY format (e.g., "2024", "2025")
|
|
55912
|
+
if (/^\d{4}$/.test(label)) {
|
|
55913
|
+
return label;
|
|
55914
|
+
}
|
|
55871
55915
|
}
|
|
55872
55916
|
|
|
55873
55917
|
// Otherwise, try to parse and format it
|
|
@@ -55875,7 +55919,7 @@ const formatDateAxis = (label, getFormatDateFn) => {
|
|
|
55875
55919
|
|
|
55876
55920
|
// If first attempt fails, try parsing as ISO date string
|
|
55877
55921
|
if (!date.isValid() && typeof label === 'string') {
|
|
55878
|
-
date = dayjs__default["default"](label, ['YYYY-MM-DD', 'YYYY-MM', 'MMM YY', 'MMM YYYY', 'DD/MM'], true);
|
|
55922
|
+
date = dayjs__default["default"](label, ['YYYY-MM-DD', 'YYYY-MM', 'YYYY', 'MMM YY', 'MMM YYYY', 'DD/MM'], true);
|
|
55879
55923
|
}
|
|
55880
55924
|
|
|
55881
55925
|
// If it's a valid date, format it using getFormatDate
|
|
@@ -55892,7 +55936,7 @@ const formatDateAxis = (label, getFormatDateFn) => {
|
|
|
55892
55936
|
* Provides state management and formatting functions for time-based charts
|
|
55893
55937
|
*
|
|
55894
55938
|
* @param {Object} options - Configuration options
|
|
55895
|
-
* @param {string} options.defaultFilter - Default time filter ('daily', 'weekly', 'monthly')
|
|
55939
|
+
* @param {string} options.defaultFilter - Default time filter ('daily', 'weekly', 'monthly', 'yearly')
|
|
55896
55940
|
* @returns {Object} Time filter state and utilities
|
|
55897
55941
|
*/
|
|
55898
55942
|
const useTimeFilter = ({
|
|
@@ -55943,6 +55987,9 @@ const selectOptions$2 = [{
|
|
|
55943
55987
|
}, {
|
|
55944
55988
|
label: "Monthly",
|
|
55945
55989
|
value: "monthly"
|
|
55990
|
+
}, {
|
|
55991
|
+
label: "Yearly",
|
|
55992
|
+
value: "yearly"
|
|
55946
55993
|
}];
|
|
55947
55994
|
const RestoredArea = ({
|
|
55948
55995
|
restoredAreaChart,
|
|
@@ -56086,6 +56133,9 @@ const selectOptions$1 = [{
|
|
|
56086
56133
|
}, {
|
|
56087
56134
|
label: "Monthly",
|
|
56088
56135
|
value: "monthly"
|
|
56136
|
+
}, {
|
|
56137
|
+
label: "Yearly",
|
|
56138
|
+
value: "yearly"
|
|
56089
56139
|
}];
|
|
56090
56140
|
const PlantingActivitiesTimeline = ({
|
|
56091
56141
|
activitiesTimelineChart,
|
|
@@ -56114,6 +56164,11 @@ const PlantingActivitiesTimeline = ({
|
|
|
56114
56164
|
while (lastNonZeroIndex >= 0 && (processedData[lastNonZeroIndex].jobs || 0) === 0) {
|
|
56115
56165
|
lastNonZeroIndex--;
|
|
56116
56166
|
}
|
|
56167
|
+
|
|
56168
|
+
// If all values are 0, return full processed data to show x-axis with default date range
|
|
56169
|
+
if (lastNonZeroIndex < 0) {
|
|
56170
|
+
return processedData;
|
|
56171
|
+
}
|
|
56117
56172
|
return processedData.slice(0, lastNonZeroIndex + 1);
|
|
56118
56173
|
}, [activitiesTimelineChart, processChartDateData]);
|
|
56119
56174
|
const maxActivitiesYValue = React.useMemo(() => {
|
|
@@ -57008,6 +57063,9 @@ const selectOptions = [{
|
|
|
57008
57063
|
}, {
|
|
57009
57064
|
label: "Monthly",
|
|
57010
57065
|
value: "monthly"
|
|
57066
|
+
}, {
|
|
57067
|
+
label: "Yearly",
|
|
57068
|
+
value: "yearly"
|
|
57011
57069
|
}];
|
|
57012
57070
|
const JobsTimeline = ({
|
|
57013
57071
|
dayJobsTimeline,
|
|
@@ -57023,22 +57081,6 @@ const JobsTimeline = ({
|
|
|
57023
57081
|
defaultFilter: 'monthly'
|
|
57024
57082
|
});
|
|
57025
57083
|
const jobsData = Array.isArray(dayJobsTimeline) ? dayJobsTimeline : dayJobsTimeline?.jobsTimeline || dayJobsTimeline?.jobs || dayJobsTimeline?.timeline || [];
|
|
57026
|
-
|
|
57027
|
-
// const jobsTimelineData = useMemo(() => {
|
|
57028
|
-
// // Always process data, even if empty, to generate default date range for x-axis
|
|
57029
|
-
// const dataToProcess = (!jobsData || !Array.isArray(jobsData) || jobsData.length === 0)
|
|
57030
|
-
// ? []
|
|
57031
|
-
// : jobsData;
|
|
57032
|
-
|
|
57033
|
-
// // Process data without cumulative calculation (for jobs timeline)
|
|
57034
|
-
// // Try to find value in total, count, jobs, or value fields
|
|
57035
|
-
// return processChartDateData({
|
|
57036
|
-
// mainData: dataToProcess,
|
|
57037
|
-
// isCumulative: false,
|
|
57038
|
-
// valueField: 'total', // Will fallback to count/jobs/value if total doesn't exist
|
|
57039
|
-
// });
|
|
57040
|
-
// }, [jobsData, processChartDateData]);
|
|
57041
|
-
|
|
57042
57084
|
const jobsTimelineData = React.useMemo(() => {
|
|
57043
57085
|
// Prepare data first
|
|
57044
57086
|
const dataToProcess = !jobsData || !Array.isArray(jobsData) || jobsData.length === 0 ? [] : jobsData;
|
|
@@ -57056,7 +57098,12 @@ const JobsTimeline = ({
|
|
|
57056
57098
|
lastNonZeroIndex--;
|
|
57057
57099
|
}
|
|
57058
57100
|
|
|
57059
|
-
//
|
|
57101
|
+
// If all values are 0, return full processed data to show x-axis with default date range
|
|
57102
|
+
if (lastNonZeroIndex < 0) {
|
|
57103
|
+
return processedData;
|
|
57104
|
+
}
|
|
57105
|
+
|
|
57106
|
+
// Otherwise, slice up to last period with data
|
|
57060
57107
|
return processedData.slice(0, lastNonZeroIndex + 1);
|
|
57061
57108
|
}, [jobsData, processChartDateData]);
|
|
57062
57109
|
const maxYValue = React.useMemo(() => {
|
|
@@ -64456,7 +64503,7 @@ function ProblemSolvers({
|
|
|
64456
64503
|
}, [data]);
|
|
64457
64504
|
const isEmpty = !pieData.length;
|
|
64458
64505
|
const getTooltipChildren = React.useCallback(items => {
|
|
64459
|
-
const item = items[0];
|
|
64506
|
+
const item = Array.isArray(items) ? items[0] : items;
|
|
64460
64507
|
return renderTooltipJsx({
|
|
64461
64508
|
title: item?.label || t("Undetermined"),
|
|
64462
64509
|
link: true,
|
package/dist/utils/index.js
CHANGED
|
@@ -7850,6 +7850,7 @@ function mapUser(user) {
|
|
|
7850
7850
|
}
|
|
7851
7851
|
|
|
7852
7852
|
const en = {
|
|
7853
|
+
"Operating Sites": "Operating Sites",
|
|
7853
7854
|
"Identified Mine Sites": "Identified Mine Sites",
|
|
7854
7855
|
"Associated Documents": "Associated Documents",
|
|
7855
7856
|
"Male": "Male",
|
|
@@ -7878,6 +7879,7 @@ const en = {
|
|
|
7878
7879
|
"events": "Events",
|
|
7879
7880
|
"merge-locations": "Merge Locations",
|
|
7880
7881
|
"edit-account": "Edit Account",
|
|
7882
|
+
"testimonials": "Testimonials",
|
|
7881
7883
|
"Are-you-sure-you-want-to-remove-the-user-from-this-account?": "Are you sure you want to remove the user from this account?",
|
|
7882
7884
|
"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.",
|
|
7883
7885
|
"merge": "Merge",
|
|
@@ -9221,6 +9223,7 @@ const en = {
|
|
|
9221
9223
|
};
|
|
9222
9224
|
|
|
9223
9225
|
const fr = {
|
|
9226
|
+
"Operating Sites": "Sites d’Exploitation",
|
|
9224
9227
|
"Identified Mine Sites": "Sites miniers identifiés",
|
|
9225
9228
|
"Associated Documents": "Documents associés",
|
|
9226
9229
|
"Male": "Masculin",
|
|
@@ -11158,6 +11161,7 @@ const fr = {
|
|
|
11158
11161
|
};
|
|
11159
11162
|
|
|
11160
11163
|
const sp = {
|
|
11164
|
+
"Operating Sites": "Sitios de Operación",
|
|
11161
11165
|
"Identified Mine Sites": "Sitios mineros identificados",
|
|
11162
11166
|
"Associated Documents": "Documentos asociados",
|
|
11163
11167
|
"Male": "Masculino",
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import { getFormatDate, getTimeQuantity, processChartDateData, formatDateAxis }
|
|
|
6
6
|
* Provides state management and formatting functions for time-based charts
|
|
7
7
|
*
|
|
8
8
|
* @param {Object} options - Configuration options
|
|
9
|
-
* @param {string} options.defaultFilter - Default time filter ('daily', 'weekly', 'monthly')
|
|
9
|
+
* @param {string} options.defaultFilter - Default time filter ('daily', 'weekly', 'monthly', 'yearly')
|
|
10
10
|
* @returns {Object} Time filter state and utilities
|
|
11
11
|
*/
|
|
12
12
|
export const useTimeFilter = ({ defaultFilter = 'monthly' } = {}) => {
|
|
@@ -58,7 +58,7 @@ function ProblemSolvers({ selectedPartners = {}, loading: parentLoading = false,
|
|
|
58
58
|
const isEmpty = !pieData.length;
|
|
59
59
|
|
|
60
60
|
const getTooltipChildren = useCallback((items) => {
|
|
61
|
-
const item = items[0];
|
|
61
|
+
const item = Array.isArray(items) ? items[0] : items;
|
|
62
62
|
|
|
63
63
|
return renderTooltipJsx({
|
|
64
64
|
title: item?.label || t("Undetermined"),
|
|
@@ -13,6 +13,7 @@ function ProductionSites({
|
|
|
13
13
|
getRedirectLink = () => {},
|
|
14
14
|
data = [],
|
|
15
15
|
loading = false,
|
|
16
|
+
APP,
|
|
16
17
|
}) {
|
|
17
18
|
|
|
18
19
|
const productionSites = useMemo(() => {
|
|
@@ -32,7 +33,7 @@ function ProductionSites({
|
|
|
32
33
|
|
|
33
34
|
return (
|
|
34
35
|
<Widget
|
|
35
|
-
title={t("
|
|
36
|
+
title={t(APP === 'wazi' ? "Operating Sites" : "Production Site")}
|
|
36
37
|
className="with-border-header no-px-body"
|
|
37
38
|
loading={loading}
|
|
38
39
|
>
|
|
@@ -14,7 +14,8 @@ function SelfAssesment({
|
|
|
14
14
|
theme = {},
|
|
15
15
|
options = {},
|
|
16
16
|
data,
|
|
17
|
-
loading
|
|
17
|
+
loading,
|
|
18
|
+
APP,
|
|
18
19
|
}) {
|
|
19
20
|
return (
|
|
20
21
|
<DashboardLayout
|
|
@@ -29,7 +30,7 @@ function SelfAssesment({
|
|
|
29
30
|
<OrganisationInformation t={t} user={user} goTo={goTo} getRedirectLink={getRedirectLink} theme={theme} data={data} loading={loading}/>
|
|
30
31
|
</section>
|
|
31
32
|
<section>
|
|
32
|
-
<ProductionSites t={t} options={options} user={user} goTo={goTo} getRedirectLink={getRedirectLink} data={data} loading={loading} />
|
|
33
|
+
<ProductionSites t={t} options={options} user={user} goTo={goTo} getRedirectLink={getRedirectLink} data={data} loading={loading} APP={APP} />
|
|
33
34
|
</section>
|
|
34
35
|
<section>
|
|
35
36
|
<AssociatedInformation t={t} user={user} goTo={goTo} getRedirectLink={getRedirectLink} data={data} loading={loading} theme={theme} options={options} />
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// import React from "react";
|
|
2
|
+
// import DafButton from "../../../Button/index.jsx";
|
|
3
|
+
// import Loading from "../../../Loading/index.jsx";
|
|
4
|
+
// import AuthForm from "../../../AuthForm/index.jsx";
|
|
5
|
+
|
|
6
|
+
// const step = 1;
|
|
7
|
+
|
|
8
|
+
// export default function ResetPassword({
|
|
9
|
+
// resetRequestSuccedded,
|
|
10
|
+
// resetRequestError,
|
|
11
|
+
// submitting,
|
|
12
|
+
// requestResetPassword,
|
|
13
|
+
// resetPassword,
|
|
14
|
+
// params: propParams = {},
|
|
15
|
+
// Layout,
|
|
16
|
+
// goTo,
|
|
17
|
+
// t,
|
|
18
|
+
// theme,
|
|
19
|
+
// errors,
|
|
20
|
+
|
|
21
|
+
// loginPath: loginPathProp,
|
|
22
|
+
// }) {
|
|
23
|
+
// const { app, confirmationToken } = propParams;
|
|
24
|
+
|
|
25
|
+
// const getLogInLink = () => {
|
|
26
|
+
// if (loginPathProp) return loginPathProp;
|
|
27
|
+
// if (app) return `/${app}/login`;
|
|
28
|
+
// return "/login";
|
|
29
|
+
// };
|
|
30
|
+
|
|
31
|
+
// const handleGoToLogin = () => {
|
|
32
|
+
// const link = getLogInLink();
|
|
33
|
+
// if (goTo && typeof goTo === "function") {
|
|
34
|
+
// goTo(link);
|
|
35
|
+
// } else {
|
|
36
|
+
// window.location.href = link;
|
|
37
|
+
// }
|
|
38
|
+
// };
|
|
39
|
+
|
|
40
|
+
// const title = !confirmationToken
|
|
41
|
+
// ? resetRequestSuccedded
|
|
42
|
+
// ? "Thank you"
|
|
43
|
+
// : "Reset Password"
|
|
44
|
+
// : resetRequestSuccedded
|
|
45
|
+
// ? "Password updated"
|
|
46
|
+
// : "Create Password";
|
|
47
|
+
|
|
48
|
+
// const subTitle = !confirmationToken
|
|
49
|
+
// ? resetRequestSuccedded
|
|
50
|
+
// ? "A password reset link has been sent to your email address. If you can’t find the message in your inbox, please check your spam folder!"
|
|
51
|
+
// : "Please enter your email, to get a link and request a new password."
|
|
52
|
+
// : resetRequestSuccedded
|
|
53
|
+
// ? "Your password has been updated, click in the button below to log in."
|
|
54
|
+
// : "Please set up your new password.";
|
|
55
|
+
|
|
56
|
+
// const requestResetFields = [
|
|
57
|
+
// {
|
|
58
|
+
// name: "email",
|
|
59
|
+
// label: t("Email"),
|
|
60
|
+
// type: "input",
|
|
61
|
+
// required: true,
|
|
62
|
+
// rules: [
|
|
63
|
+
// {
|
|
64
|
+
// required: true,
|
|
65
|
+
// message: t("errors::email should not be empty"),
|
|
66
|
+
// },
|
|
67
|
+
// {
|
|
68
|
+
// pattern:
|
|
69
|
+
// /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/,
|
|
70
|
+
// message: t("errors::email is not valid"),
|
|
71
|
+
// },
|
|
72
|
+
// ],
|
|
73
|
+
// placeholder: t("Email"),
|
|
74
|
+
// },
|
|
75
|
+
// ];
|
|
76
|
+
|
|
77
|
+
// const resetPasswordFields = [
|
|
78
|
+
// {
|
|
79
|
+
// name: "password",
|
|
80
|
+
// label: t("Enter password"),
|
|
81
|
+
// type: "password",
|
|
82
|
+
// required: true,
|
|
83
|
+
// rules: [
|
|
84
|
+
// {
|
|
85
|
+
// required: true,
|
|
86
|
+
// message: t("errors::password should not be empty"),
|
|
87
|
+
// },
|
|
88
|
+
// ],
|
|
89
|
+
// placeholder: t("••••••••"),
|
|
90
|
+
// },
|
|
91
|
+
// {
|
|
92
|
+
// name: "confirmPassword",
|
|
93
|
+
// label: t("Confirm password"),
|
|
94
|
+
// type: "password",
|
|
95
|
+
// required: true,
|
|
96
|
+
// dependencies: ["password"],
|
|
97
|
+
// rules: [
|
|
98
|
+
// {
|
|
99
|
+
// required: true,
|
|
100
|
+
// message: t("errors::password should not be empty"),
|
|
101
|
+
// },
|
|
102
|
+
// ({ getFieldValue }) => ({
|
|
103
|
+
// validator(rule, value) {
|
|
104
|
+
// if (!value || getFieldValue("password") === value) {
|
|
105
|
+
// return Promise.resolve();
|
|
106
|
+
// }
|
|
107
|
+
// return Promise.reject(t("errors::passwordNotMatch"));
|
|
108
|
+
// },
|
|
109
|
+
// }),
|
|
110
|
+
// ],
|
|
111
|
+
// placeholder: t("••••••••"),
|
|
112
|
+
// },
|
|
113
|
+
// ];
|
|
114
|
+
|
|
115
|
+
// const handleRequestResetSubmit = (values) => {
|
|
116
|
+
// requestResetPassword(values);
|
|
117
|
+
// };
|
|
118
|
+
|
|
119
|
+
// const handleResetPasswordSubmit = (values) => {
|
|
120
|
+
|
|
121
|
+
// resetPassword({
|
|
122
|
+
// ...values,
|
|
123
|
+
// passConfirmationToken: confirmationToken,
|
|
124
|
+
// });
|
|
125
|
+
// };
|
|
126
|
+
|
|
127
|
+
// const currentTheme = theme || window.theme;
|
|
128
|
+
|
|
129
|
+
// const Content = (
|
|
130
|
+
// <>
|
|
131
|
+
// {!resetRequestSuccedded && !confirmationToken && (
|
|
132
|
+
// <>
|
|
133
|
+
// <AuthForm
|
|
134
|
+
// fields={requestResetFields}
|
|
135
|
+
// onSubmit={handleRequestResetSubmit}
|
|
136
|
+
// submitText={t("Get Link")}
|
|
137
|
+
// errors={errors}
|
|
138
|
+
// t={t}
|
|
139
|
+
// executeRecaptcha={() => Promise.resolve(true)}
|
|
140
|
+
// theme={currentTheme}
|
|
141
|
+
// submitButtonProps={{
|
|
142
|
+
// loading: submitting,
|
|
143
|
+
// }}
|
|
144
|
+
// />
|
|
145
|
+
// <div className="mt-4">
|
|
146
|
+
// <DafButton
|
|
147
|
+
// type="default"
|
|
148
|
+
// className="normal-br"
|
|
149
|
+
// style={
|
|
150
|
+
// currentTheme
|
|
151
|
+
// ? {
|
|
152
|
+
// borderColor: currentTheme.colorPrimary,
|
|
153
|
+
// color: currentTheme.colorPrimary,
|
|
154
|
+
// }
|
|
155
|
+
// : {}
|
|
156
|
+
// }
|
|
157
|
+
// onClick={handleGoToLogin}
|
|
158
|
+
// >
|
|
159
|
+
// {t("Back")}
|
|
160
|
+
// </DafButton>
|
|
161
|
+
// </div>
|
|
162
|
+
|
|
163
|
+
// {resetRequestError ? (
|
|
164
|
+
// <div
|
|
165
|
+
// className="ant-form-item-explain errors-cont no-pt mt-3"
|
|
166
|
+
// style={{ color: "#ff4d4f" }}
|
|
167
|
+
// >
|
|
168
|
+
// {t(resetRequestError)}
|
|
169
|
+
// </div>
|
|
170
|
+
// ) : null}
|
|
171
|
+
// </>
|
|
172
|
+
// )}
|
|
173
|
+
|
|
174
|
+
// {!resetRequestSuccedded && confirmationToken && (
|
|
175
|
+
// <AuthForm
|
|
176
|
+
// fields={resetPasswordFields}
|
|
177
|
+
// onSubmit={handleResetPasswordSubmit}
|
|
178
|
+
// submitText={t("Reset Password")}
|
|
179
|
+
// errors={errors}
|
|
180
|
+
// t={t}
|
|
181
|
+
// executeRecaptcha={() => Promise.resolve(true)}
|
|
182
|
+
// theme={currentTheme}
|
|
183
|
+
// submitButtonProps={{
|
|
184
|
+
// loading: submitting,
|
|
185
|
+
// }}
|
|
186
|
+
// />
|
|
187
|
+
// )}
|
|
188
|
+
|
|
189
|
+
// {resetRequestSuccedded && confirmationToken && (
|
|
190
|
+
// <div className="buttons">
|
|
191
|
+
// <DafButton
|
|
192
|
+
// type="primary"
|
|
193
|
+
// className="normal-br"
|
|
194
|
+
// style={
|
|
195
|
+
// currentTheme
|
|
196
|
+
// ? {
|
|
197
|
+
// backgroundColor: currentTheme.colorPrimary,
|
|
198
|
+
// borderColor: currentTheme.colorPrimary,
|
|
199
|
+
// }
|
|
200
|
+
// : {}
|
|
201
|
+
// }
|
|
202
|
+
// onClick={handleGoToLogin}
|
|
203
|
+
// >
|
|
204
|
+
// {t("Log In")}
|
|
205
|
+
// </DafButton>
|
|
206
|
+
// </div>
|
|
207
|
+
// )}
|
|
208
|
+
|
|
209
|
+
// {resetRequestSuccedded && !confirmationToken && null}
|
|
210
|
+
// </>
|
|
211
|
+
// );
|
|
212
|
+
|
|
213
|
+
// if (Layout) {
|
|
214
|
+
// return (
|
|
215
|
+
// <Layout app={app} step={step} title={title} subTitle={subTitle}>
|
|
216
|
+
// {Content}
|
|
217
|
+
// </Layout>
|
|
218
|
+
// );
|
|
219
|
+
// }
|
|
220
|
+
|
|
221
|
+
// return (
|
|
222
|
+
// <div style={{ padding: 20, maxWidth: 400, margin: "0 auto" }}>
|
|
223
|
+
// <h2>{title}</h2>
|
|
224
|
+
// <p>{subTitle}</p>
|
|
225
|
+
// {Content}
|
|
226
|
+
// </div>
|
|
227
|
+
// );
|
|
228
|
+
// }
|
|
@@ -7,6 +7,7 @@ const selectOptions = [
|
|
|
7
7
|
{ label: "Daily", value: "daily" },
|
|
8
8
|
{ label: "Weekly", value: "weekly" },
|
|
9
9
|
{ label: "Monthly", value: "monthly" },
|
|
10
|
+
{ label: "Yearly", value: "yearly" },
|
|
10
11
|
];
|
|
11
12
|
|
|
12
13
|
const JobsTimeline = ({
|
|
@@ -20,20 +21,6 @@ const JobsTimeline = ({
|
|
|
20
21
|
? dayJobsTimeline
|
|
21
22
|
: (dayJobsTimeline?.jobsTimeline || dayJobsTimeline?.jobs || dayJobsTimeline?.timeline || []);
|
|
22
23
|
|
|
23
|
-
// const jobsTimelineData = useMemo(() => {
|
|
24
|
-
// // Always process data, even if empty, to generate default date range for x-axis
|
|
25
|
-
// const dataToProcess = (!jobsData || !Array.isArray(jobsData) || jobsData.length === 0)
|
|
26
|
-
// ? []
|
|
27
|
-
// : jobsData;
|
|
28
|
-
|
|
29
|
-
// // Process data without cumulative calculation (for jobs timeline)
|
|
30
|
-
// // Try to find value in total, count, jobs, or value fields
|
|
31
|
-
// return processChartDateData({
|
|
32
|
-
// mainData: dataToProcess,
|
|
33
|
-
// isCumulative: false,
|
|
34
|
-
// valueField: 'total', // Will fallback to count/jobs/value if total doesn't exist
|
|
35
|
-
// });
|
|
36
|
-
// }, [jobsData, processChartDateData]);
|
|
37
24
|
|
|
38
25
|
const jobsTimelineData = useMemo(() => {
|
|
39
26
|
// Prepare data first
|
|
@@ -54,7 +41,12 @@ const JobsTimeline = ({
|
|
|
54
41
|
lastNonZeroIndex--;
|
|
55
42
|
}
|
|
56
43
|
|
|
57
|
-
//
|
|
44
|
+
// If all values are 0, return full processed data to show x-axis with default date range
|
|
45
|
+
if (lastNonZeroIndex < 0) {
|
|
46
|
+
return processedData;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Otherwise, slice up to last period with data
|
|
58
50
|
return processedData.slice(0, lastNonZeroIndex + 1);
|
|
59
51
|
}, [jobsData, processChartDateData]);
|
|
60
52
|
|
|
@@ -7,6 +7,7 @@ const selectOptions = [
|
|
|
7
7
|
{ label: "Daily", value: "daily" },
|
|
8
8
|
{ label: "Weekly", value: "weekly" },
|
|
9
9
|
{ label: "Monthly", value: "monthly" },
|
|
10
|
+
{ label: "Yearly", value: "yearly" },
|
|
10
11
|
];
|
|
11
12
|
|
|
12
13
|
const PlantingActivitiesTimeline = ({
|
|
@@ -34,6 +35,11 @@ const PlantingActivitiesTimeline = ({
|
|
|
34
35
|
lastNonZeroIndex--;
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
// If all values are 0, return full processed data to show x-axis with default date range
|
|
39
|
+
if (lastNonZeroIndex < 0) {
|
|
40
|
+
return processedData;
|
|
41
|
+
}
|
|
42
|
+
|
|
37
43
|
return processedData.slice(0, lastNonZeroIndex + 1);
|
|
38
44
|
}, [activitiesTimelineChart, processChartDateData]);
|
|
39
45
|
|