Skip to content

Commit 2d930a7

Browse files
authored
Merge pull request #2547 from tekdi/feat-lead-mapping-new
Feat lead mapping new to feat qa
2 parents 2cc94cb + 37006af commit 2d930a7

File tree

14 files changed

+7292
-19
lines changed

14 files changed

+7292
-19
lines changed

apps/admin-app-repo/src/constant/Forms/ContentCreatorSearch.js

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,40 @@ export const ContentCreatorSearchSchema = {
2525
isMultiSelect: true,
2626
maxSelection: 1000,
2727
},
28+
board: {
29+
"type": "array",
30+
"title": "BOARD",
31+
"coreField": 0,
32+
"fieldId": "f93c0ac3-f827-4794-9457-441fa1057b42",
33+
"field_type": "drop_down",
34+
"maxSelection": 10000,
35+
"isMultiSelect": true,
36+
"uniqueItems": true,
37+
"isRequired": true,
38+
"items": {
39+
"type": "string",
40+
"enum": [
41+
"Select"
42+
],
43+
"enumNames": [
44+
"Select"
45+
]
46+
},
47+
"api": {
48+
"url": "/api/dynamic-form/get-framework",
49+
"method": "POST",
50+
"options": {
51+
"label": "label",
52+
"value": "value",
53+
"optionObj": "options"
54+
},
55+
"payload": {
56+
"code": "board",
57+
"fetchUrl": `${process.env.NEXT_PUBLIC_MIDDLEWARE_URL}/api/framework/v1/read/scp-framework`
58+
},
59+
"callType": "initial"
60+
}
61+
},
2862
name: {
2963
type: 'string',
3064
title: 'Search Content Creator',
@@ -54,7 +88,14 @@ export const ContentCreatorUISchema = {
5488
uniqueItems: true,
5589
},
5690
},
57-
91+
board: {
92+
"ui:widget": "AutoCompleteMultiSelectWidget",
93+
"ui:options": {
94+
"multiple": true,
95+
"uniqueItems": true,
96+
"hideError": false
97+
}
98+
},
5899
firstName: {
59100
'ui:widget': 'SearchTextFieldWidget',
60101
},

apps/admin-app-repo/src/constant/Forms/ContentReviewerSearch.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,40 @@ export const ContentReviewerSearchSchema = {
2525
isMultiSelect: true,
2626
maxSelection: 1000,
2727
},
28+
board: {
29+
"type": "array",
30+
"title": "BOARD",
31+
"coreField": 0,
32+
"fieldId": "f93c0ac3-f827-4794-9457-441fa1057b42",
33+
"field_type": "drop_down",
34+
"maxSelection": 10000,
35+
"isMultiSelect": true,
36+
"uniqueItems": true,
37+
"isRequired": true,
38+
"items": {
39+
"type": "string",
40+
"enum": [
41+
"Select"
42+
],
43+
"enumNames": [
44+
"Select"
45+
]
46+
},
47+
"api": {
48+
"url": "/api/dynamic-form/get-framework",
49+
"method": "POST",
50+
"options": {
51+
"label": "label",
52+
"value": "value",
53+
"optionObj": "options"
54+
},
55+
"payload": {
56+
"code": "board",
57+
"fetchUrl": `${process.env.NEXT_PUBLIC_MIDDLEWARE_URL}/api/framework/v1/read/scp-framework`
58+
},
59+
"callType": "initial"
60+
}
61+
},
2862
name: {
2963
type: 'string',
3064
title: 'Search Content Reviewer',
@@ -54,6 +88,14 @@ export const ContentReviewerUISchema = {
5488
uniqueItems: true,
5589
},
5690
},
91+
board: {
92+
"ui:widget": "AutoCompleteMultiSelectWidget",
93+
"ui:options": {
94+
"multiple": true,
95+
"uniqueItems": true,
96+
"hideError": false
97+
}
98+
},
5799

58100
firstName: {
59101
'ui:widget': 'SearchTextFieldWidget',

apps/admin-app-repo/src/pages/api/dynamic-form/get-framework.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ export default function handler(req, res) {
5656
} else if (selectedvalue != '') {
5757
// Transform terms into options
5858
// console.log('in initial state');
59-
options = categories?.terms.map((term) => ({
60-
label: term.name,
61-
value: term.name,
62-
}));
59+
options = categories?.terms
60+
.filter((term) => term.status !== "Retired") // Filter out retired boards
61+
.map((term) => ({
62+
label: term.name,
63+
value: term.name,
64+
}));
6365
}
6466
// console.log('option', options);
6567
}

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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import deleteIcon from '../../public/images/deleteIcon.svg';
5454
import restoreIcon from '../../public/images/restore_user.svg';
5555
import CloseIcon from '@mui/icons-material/Close';
5656
import BatchListWidget from '@shared-lib-v2/MapUser/BatchListWidget';
57+
import MultipleBatchListWidget from '@shared-lib-v2/MapUser/MultipleBatchListWidget';
5758
import EmailSearchUser from '@shared-lib-v2/MapUser/EmailSearchUser';
5859
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
5960

@@ -799,6 +800,8 @@ const Facilitator = () => {
799800
const [selectedCenterId, setSelectedCenterId] = useState<
800801
string | string[] | null
801802
>(null);
803+
const [selectedCenterList, setSelectedCenterList] = useState<any[]>([]);
804+
const [selectedBatchList, setSelectedBatchList] = useState<any[]>([]);
802805
const [selectedUserId, setSelectedUserId] = useState<string | null>(null);
803806
const [isMappingInProgress, setIsMappingInProgress] = useState(false);
804807
const [userDetails, setUserDetails] = useState<any>(null);
@@ -812,6 +815,8 @@ const Facilitator = () => {
812815

813816
// Helper function to extract all batch IDs from the nested structure
814817
const extractBatchIds = (nestedStructure: any): string[] => {
818+
return nestedStructure;
819+
815820
const batchIds: string[] = [];
816821

817822
if (!nestedStructure || !Array.isArray(nestedStructure)) {
@@ -1043,6 +1048,8 @@ const Facilitator = () => {
10431048
if (reason !== 'backdropClick') {
10441049
setMapModalOpen(false);
10451050
setSelectedCenterId(null); // Reset center selection when dialog closes
1051+
setSelectedCenterList(null); // Reset center list selection when dialog closes
1052+
setSelectedBatchList(null); // Reset batch selection when dialog closes
10461053
setSelectedUserId(null); // Reset user selection when dialog closes
10471054
setUserDetails(null);
10481055
}
@@ -1132,13 +1139,23 @@ const Facilitator = () => {
11321139
)}
11331140
{formStep === 1 && (
11341141
<Box sx={{ mb: 3 }}>
1135-
<BatchListWidget
1142+
<MultipleBatchListWidget
11361143
value={selectedCenterId}
11371144
onChange={(centerId) => {
11381145
setSelectedCenterId(centerId);
11391146
console.log('Selected Center ID:', centerId);
11401147
}}
1141-
label="Select Center"
1148+
onCenterList={(centerList) => {
1149+
setSelectedCenterList(centerList || []);
1150+
console.log('############# centerList', centerList);
1151+
}}
1152+
selectedCenterList={selectedCenterList}
1153+
onBatchList={(batchList) => {
1154+
setSelectedBatchList(batchList || []);
1155+
console.log('############# batchList', batchList);
1156+
}}
1157+
selectedBatchList={selectedBatchList}
1158+
label="Select Batch"
11421159
required={true}
11431160
multiple={false}
11441161
/>
@@ -1243,6 +1260,8 @@ const Facilitator = () => {
12431260
// Close dialog
12441261
setMapModalOpen(false);
12451262
setSelectedCenterId(null);
1263+
setSelectedCenterList(null);
1264+
setSelectedBatchList(null);
12461265
setSelectedUserId(null);
12471266
// Refresh the data
12481267
searchData(prefilledFormData, 0);

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import CenteredLoader from '@/components/CenteredLoader/CenteredLoader';
6363
import ResetFiltersButton from '@/components/ResetFiltersButton/ResetFiltersButton';
6464
import restoreIcon from '../../public/images/restore_user.svg';
6565
import { showToastMessage } from '@/components/Toastify';
66-
import CenterListWidget from '@shared-lib-v2/MapUser/CenterListWidget';
66+
import MultipleCenterListWidgetNew from '@shared-lib-v2/MapUser/MultipleCenterListWidgetNew';
6767
import EmailSearchUser from '@shared-lib-v2/MapUser/EmailSearchUser';
6868
import { API_ENDPOINTS } from '@/utils/API/APIEndpoints';
6969
import { updateUser } from '@/services/CreateUserService';
@@ -576,6 +576,7 @@ const UserLeader = () => {
576576
const [selectedCenterId, setSelectedCenterId] = useState<
577577
string | string[] | null
578578
>(null);
579+
const [selectedCenterList, setSelectedCenterList] = useState<any[]>([]);
579580
const [selectedUserId, setSelectedUserId] = useState<string | null>(null);
580581
const [isMappingInProgress, setIsMappingInProgress] = useState(false);
581582
const [userDetails, setUserDetails] = useState<any>(null);
@@ -716,6 +717,7 @@ const UserLeader = () => {
716717
if (reason !== 'backdropClick') {
717718
setMapModalOpen(false);
718719
setSelectedCenterId(null); // Reset center selection when dialog closes
720+
setSelectedCenterList([]); // Reset center list when dialog closes
719721
setSelectedUserId(null); // Reset user selection when dialog closes
720722
setUserDetails(null);
721723
}
@@ -805,12 +807,17 @@ const UserLeader = () => {
805807
)}
806808
{formStep === 1 && (
807809
<Box sx={{ mb: 3 }}>
808-
<CenterListWidget
810+
<MultipleCenterListWidgetNew
809811
value={selectedCenterId}
810812
onChange={(centerId) => {
811813
setSelectedCenterId(centerId);
812814
console.log('Selected Center ID:', centerId);
813815
}}
816+
onCenterList={(centerList) => {
817+
setSelectedCenterList(centerList || []);
818+
console.log('############# centerList', centerList);
819+
}}
820+
selectedCenterList={selectedCenterList}
814821
label="Select Center"
815822
required={true}
816823
multiple={false}
@@ -915,6 +922,7 @@ const UserLeader = () => {
915922
// Close dialog
916923
setMapModalOpen(false);
917924
setSelectedCenterId(null);
925+
setSelectedCenterList([]);
918926
setSelectedUserId(null);
919927
// Refresh the data
920928
searchData(prefilledFormData, 0);

apps/teachers/src/pages/api/dynamic-form/get-framework.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ export default function handler(req, res) {
5656
} else if (selectedvalue != '') {
5757
// Transform terms into options
5858
// console.log('in initial state');
59-
options = categories?.terms.map((term) => ({
60-
label: term.name,
61-
value: term.name,
62-
}));
59+
options = categories?.terms
60+
.filter((term) => term.status !== "Retired") // Filter out retired boards
61+
.map((term) => ({
62+
label: term.name,
63+
value: term.name,
64+
}));
6365
}
6466
// console.log('option', options);
6567
}

libs/shared-lib-v2/src/DynamicForm/utils/Helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ export const getOptionsByCategory = (frameworks: any, categoryCode: string) => {
651651

652652
// Return the mapped terms
653653
return category?.terms?.filter((term: any) => {
654-
if (term.status === 'Live') {
654+
if (term.status === 'Live' && term.status !== "Retired") {
655655
return {
656656
name: term?.name,
657657
code: term?.code,

0 commit comments

Comments
 (0)