Skip to content

Commit 0247d81

Browse files
authored
Merge pull request #2650 from rushi-tekdi/release-1.15.0
Release 1.15.0 to release 1.15.0
2 parents a9d11a5 + b4e22de commit 0247d81

File tree

6 files changed

+320
-205
lines changed

6 files changed

+320
-205
lines changed

apps/admin-app-repo/src/pages/user-instructor.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,9 +626,13 @@ const Facilitator = () => {
626626
const userId = row?.userId;
627627
const cohortData = row?.cohortData;
628628
setSelectedUserIdReassign(userId);
629-
const apiUrl = `${process.env.NEXT_PUBLIC_MIDDLEWARE_URL}/cohort/geographical-hierarchy/${userId}`;
630-
const response = await axios.get(apiUrl, { headers });
631-
const geographicalData = response?.data?.result || [];
629+
const apiUrl = `${process.env.NEXT_PUBLIC_MIDDLEWARE_URL}/cohort/geographical-hierarchy`;
630+
let response=null;
631+
try{
632+
response = await axios.post(apiUrl, { userId: userId }, { headers });
633+
}
634+
catch(e){}
635+
const geographicalData = response?.data?.result?.data || [];
632636

633637
// Transform geographicalData into centerList
634638
const centerList = [];

apps/admin-app-repo/src/pages/user-leader.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,13 @@ const UserLeader = () => {
479479
const userId = row?.userId;
480480
const cohortData = row?.cohortData;
481481
setSelectedUserIdReassign(userId);
482-
const apiUrl = `${process.env.NEXT_PUBLIC_MIDDLEWARE_URL}/cohort/geographical-hierarchy/${userId}`;
483-
const response = await axios.get(apiUrl, { headers });
484-
const geographicalData = response?.data?.result || [];
482+
const apiUrl = `${process.env.NEXT_PUBLIC_MIDDLEWARE_URL}/cohort/geographical-hierarchy`;
483+
let response=null;
484+
try{
485+
response = await axios.post(apiUrl, { userId: userId }, { headers });
486+
}
487+
catch(e){}
488+
const geographicalData = response?.data?.result?.data || [];
485489

486490
// Transform geographicalData into centerList
487491
const centerList = [];

libs/shared-lib-v2/src/MapUser/MultipleBatchListWidget.tsx

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
236236
const currentSelectedState = Array.isArray(prevSelectedState)
237237
? prevSelectedState
238238
: prevSelectedState
239-
? [prevSelectedState]
240-
: [];
239+
? [prevSelectedState]
240+
: [];
241241
const currentStateId = stateId ? String(stateId) : null;
242242
const currentInitialState = initialState
243243
? Array.isArray(initialState)
@@ -275,8 +275,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
275275
const currentSelectedState = Array.isArray(prevSelectedState)
276276
? prevSelectedState
277277
: prevSelectedState
278-
? [prevSelectedState]
279-
: [];
278+
? [prevSelectedState]
279+
: [];
280280
const currentStateId = stateId ? String(stateId) : null;
281281
const currentInitialState = initialState
282282
? Array.isArray(initialState)
@@ -318,17 +318,17 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
318318
const selectedStates = Array.isArray(selectedState)
319319
? selectedState
320320
: selectedState
321-
? [selectedState]
322-
: [];
321+
? [selectedState]
322+
: [];
323323

324324
// For non-central admin, always use stateId from localStorage
325325
// For central admin, use selectedStates
326326
const controllingField =
327327
!isCentralAdmin && stateId
328328
? [stateId]
329329
: selectedStates.length > 0
330-
? selectedStates
331-
: [];
330+
? selectedStates
331+
: [];
332332

333333
if (controllingField.length === 0) {
334334
setDistrictOptions([]);
@@ -357,8 +357,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
357357
const currentSelectedDistricts = Array.isArray(selectedDistrict)
358358
? selectedDistrict
359359
: selectedDistrict
360-
? [selectedDistrict]
361-
: [];
360+
? [selectedDistrict]
361+
: [];
362362
const currentInitialDistricts = initialDistrict
363363
? Array.isArray(initialDistrict)
364364
? initialDistrict
@@ -416,8 +416,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
416416
const selectedDistricts = Array.isArray(selectedDistrict)
417417
? selectedDistrict
418418
: selectedDistrict
419-
? [selectedDistrict]
420-
: [];
419+
? [selectedDistrict]
420+
: [];
421421

422422
if (selectedDistricts.length === 0) {
423423
setBlockOptions([]);
@@ -549,8 +549,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
549549
const selectedStates = Array.isArray(selectedState)
550550
? selectedState
551551
: selectedState
552-
? [selectedState]
553-
: [];
552+
? [selectedState]
553+
: [];
554554

555555
// If no state selected and no search keyword, don't search
556556
if (selectedStates.length === 0 && !searchKeyword) {
@@ -576,8 +576,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
576576
const selectedDistricts = Array.isArray(selectedDistrict)
577577
? selectedDistrict
578578
: selectedDistrict
579-
? [selectedDistrict]
580-
: [];
579+
? [selectedDistrict]
580+
: [];
581581
if (selectedDistricts.length > 0) {
582582
filters.district = selectedDistricts;
583583
}
@@ -688,8 +688,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
688688
const selectedStates = Array.isArray(selectedState)
689689
? selectedState
690690
: selectedState
691-
? [selectedState]
692-
: [];
691+
? [selectedState]
692+
: [];
693693

694694
// If no state selected and no search keyword, clear options
695695
if (selectedStates.length === 0 && !searchKeyword) {
@@ -1002,11 +1002,11 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
10021002
const centerIdsToFetch = filtersChanged
10031003
? selectedCenters.map((center) => center.value) // Refetch all when filters change
10041004
: selectedCenters
1005-
.filter((center) => {
1006-
const centerBatches = batchesRef.current[center.value];
1007-
return !centerBatches || centerBatches.length === 0;
1008-
})
1009-
.map((center) => center.value); // Only fetch missing ones otherwise
1005+
.filter((center) => {
1006+
const centerBatches = batchesRef.current[center.value];
1007+
return !centerBatches || centerBatches.length === 0;
1008+
})
1009+
.map((center) => center.value); // Only fetch missing ones otherwise
10101010

10111011
// Only call API if we have center IDs to fetch (never call with empty array)
10121012
if (centerIdsToFetch && centerIdsToFetch.length > 0) {
@@ -1019,8 +1019,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
10191019
const stateIds = Array.isArray(newValue)
10201020
? newValue.map((state) => String(state.value))
10211021
: newValue
1022-
? [String(newValue.value)]
1023-
: [];
1022+
? [String(newValue.value)]
1023+
: [];
10241024

10251025
setSelectedState(stateIds);
10261026
setSelectedDistrict([]);
@@ -1041,8 +1041,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
10411041
const districtIds = Array.isArray(newValue)
10421042
? newValue.map((district) => String(district.value))
10431043
: newValue
1044-
? [String(district.value)]
1045-
: [];
1044+
? [String(district.value)]
1045+
: [];
10461046

10471047
setSelectedDistrict(districtIds);
10481048
setSelectedBlock([]);
@@ -1062,8 +1062,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
10621062
const blockIds = Array.isArray(newValue)
10631063
? newValue.map((block) => String(block.value))
10641064
: newValue
1065-
? [String(newValue.value)]
1066-
: [];
1065+
? [String(newValue.value)]
1066+
: [];
10671067

10681068
setSelectedBlock(blockIds);
10691069
setSelectedVillage([]);
@@ -1082,8 +1082,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
10821082
const villageIds = Array.isArray(newValue)
10831083
? newValue.map((village) => String(village.value))
10841084
: newValue
1085-
? [String(newValue.value)]
1086-
: [];
1085+
? [String(newValue.value)]
1086+
: [];
10871087

10881088
setSelectedVillage(villageIds);
10891089
setCenterOptions([]); // Clear centers when filter changes
@@ -1094,7 +1094,7 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
10941094
};
10951095

10961096
const handleClearFilters = () => {
1097-
setSelectedState([]);
1097+
setSelectedState(stateId ? [String(stateId)] : []);
10981098
setSelectedDistrict([]);
10991099
setSelectedBlock([]);
11001100
setSelectedVillage([]);
@@ -1502,13 +1502,13 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
15021502
const selectedStates = Array.isArray(selectedState)
15031503
? selectedState
15041504
: selectedState
1505-
? [selectedState]
1506-
: [];
1505+
? [selectedState]
1506+
: [];
15071507
const selectedDistricts = Array.isArray(selectedDistrict)
15081508
? selectedDistrict
15091509
: selectedDistrict
1510-
? [selectedDistrict]
1511-
: [];
1510+
? [selectedDistrict]
1511+
: [];
15121512
count += selectedStates.length;
15131513
count += selectedDistricts.length;
15141514
count += selectedBlock.length;
@@ -1570,9 +1570,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
15701570
</Typography>
15711571
<Typography variant="caption" color="text.secondary">
15721572
{hasActiveFilters
1573-
? `${activeFiltersCount} filter${
1574-
activeFiltersCount > 1 ? 's' : ''
1575-
} active`
1573+
? `${activeFiltersCount} filter${activeFiltersCount > 1 ? 's' : ''
1574+
} active`
15761575
: 'No filters applied'}
15771576
</Typography>
15781577
</Box>
@@ -1615,8 +1614,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
16151614
const selectedStates = Array.isArray(selectedState)
16161615
? selectedState
16171616
: selectedState
1618-
? [selectedState]
1619-
: [];
1617+
? [selectedState]
1618+
: [];
16201619
return selectedStates.includes(String(state.value));
16211620
})}
16221621
onChange={handleStateChange}
@@ -1694,8 +1693,8 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
16941693
const selectedDistricts = Array.isArray(selectedDistrict)
16951694
? selectedDistrict
16961695
: selectedDistrict
1697-
? [selectedDistrict]
1698-
: [];
1696+
? [selectedDistrict]
1697+
: [];
16991698
return selectedDistricts.includes(String(district.value));
17001699
})}
17011700
onChange={handleDistrictChange}
@@ -2642,7 +2641,7 @@ const MultipleBatchListWidget: React.FC<MultipleBatchListWidgetProps> = ({
26422641
<Chip
26432642
key={`${batch.id}-${batch.centerId}`}
26442643
label={
2645-
<Box sx={{ mt:2 }}>
2644+
<Box sx={{ mt: 2 }}>
26462645
<Typography variant="body2" fontWeight={600}>
26472646
{batch.name}
26482647
</Typography>

libs/shared-lib-v2/src/MapUser/MultipleCenterListWidgetNew.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ const MultipleCenterListWidget: React.FC<MultipleCenterListWidgetProps> = ({
721721
};
722722

723723
const handleClearFilters = () => {
724-
setSelectedState([]);
724+
setSelectedState(stateId ? [String(stateId)] : []);
725725
setSelectedDistrict([]);
726726
setSelectedBlock([]);
727727
setSelectedVillage([]);

0 commit comments

Comments
 (0)