Skip to content

Commit 569ec3e

Browse files
authored
Merge pull request #2682 from Rushikesh-Sonawane99/release-1.15.0
Issue #PS-6430 chore: Changes in Batch Type for SCP in lap and lmp
2 parents 8f8b461 + aa57766 commit 569ec3e

File tree

4 files changed

+26
-33
lines changed

4 files changed

+26
-33
lines changed

apps/admin-app-repo/src/components/BatchFlow/BatchFlow.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,21 @@ const BatchFlow: React.FC<BatchFlowProps> = ({
149149
// Modify batch_type based on centerType
150150
if (centerType && alterSchema?.properties?.batch_type) {
151151
if (centerType === 'remote') {
152-
// For remote center: show only "remote" option
153-
alterSchema.properties.batch_type.enum = ['remote'];
154-
alterSchema.properties.batch_type.enumNames = ['REMOTE'];
152+
// For remote center: show "remote" and "hybrid" options
153+
alterSchema.properties.batch_type.enum = ['remote', 'hybrid'];
154+
alterSchema.properties.batch_type.enumNames = ['REMOTE', 'HYBRID'];
155155
alterSchema.properties.batch_type.default = 'remote';
156-
if (alterUiSchema?.batch_type) {
157-
alterUiSchema.batch_type['ui:disabled'] = true;
158-
}
159-
} else if (centerType === 'regular') {
160-
// For regular center: show only "regular" and "contact" options
161-
alterSchema.properties.batch_type.enum = ['regular', 'contact'];
162-
alterSchema.properties.batch_type.enumNames = ['REGULAR', 'CONTACT'];
163156
if (alterUiSchema?.batch_type?.['ui:disabled']) {
164157
delete alterUiSchema.batch_type['ui:disabled'];
165158
}
159+
} else if (centerType === 'regular') {
160+
// For regular center: show only "regular" option (disabled)
161+
alterSchema.properties.batch_type.enum = ['regular'];
162+
alterSchema.properties.batch_type.enumNames = ['REGULAR'];
163+
alterSchema.properties.batch_type.default = 'regular';
164+
if (alterUiSchema?.batch_type) {
165+
alterUiSchema.batch_type['ui:disabled'] = true;
166+
}
166167
}
167168
}
168169

@@ -374,8 +375,8 @@ const BatchFlow: React.FC<BatchFlowProps> = ({
374375
buildSchemaAndUi(true, existingValues);
375376
let tempFormData = extractMatchingKeys(row, addSchema);
376377
// Force batch_type to "remote" if centerType is "remote"
377-
if (centerType === 'remote') {
378-
tempFormData.batch_type = 'remote';
378+
if (centerType === 'regular') {
379+
tempFormData.batch_type = 'regular';
379380
}
380381
setPrefilledAddFormData(tempFormData);
381382
setIsEdit(true);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ export const BatchCreateSchema = {
118118
enum: [
119119
'remote',
120120
'regular',
121-
'contact',
121+
'hybrid',
122122
],
123123
enumNames: [
124124
'REMOTE',
125125
'REGULAR',
126-
'CONTACT',
126+
'HYBRID',
127127
],
128128
},
129129
},

libs/shared-lib-v2/src/lib/context/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@
688688
"DESIGNATION": "Designation",
689689
"REGULAR": "Regular",
690690
"REMOTE": "Remote",
691+
"HYBRID": "Hybrid",
691692
"NOTE_THIS_WILL_BE_CENTER_NAME": "Note : This will be center name",
692693
"STATE": "State",
693694
"DISTRICT": "District",

mfes/scp-teacher-repo/src/pages/centers/index.tsx

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -587,31 +587,22 @@ const CentersPage = () => {
587587
const ct = (params.centerType || '').toLowerCase();
588588
if (schema?.properties?.batch_type) {
589589
if (ct === 'remote') {
590-
schema.properties.batch_type.enum = ['remote'];
591-
schema.properties.batch_type.enumNames = ['REMOTE'];
590+
// For remote center: show "remote" and "hybrid" options
591+
schema.properties.batch_type.enum = ['remote', 'hybrid'];
592+
schema.properties.batch_type.enumNames = ['Remote', 'Hybrid'];
592593
schema.properties.batch_type.default = 'remote';
593594
prefill.batch_type = 'remote';
595+
ensureEnabled('batch_type');
596+
} else if (ct === 'regular') {
597+
// For regular center: show only "regular" option (disabled)
598+
schema.properties.batch_type.enum = ['regular'];
599+
schema.properties.batch_type.enumNames = ['Regular'];
600+
schema.properties.batch_type.default = 'regular';
601+
prefill.batch_type = 'regular';
594602
uiSchema.batch_type = {
595603
...(uiSchema?.batch_type || {}),
596604
'ui:disabled': true,
597605
};
598-
} else if (ct === 'regular') {
599-
// Only restrict if enum exists; otherwise leave as-is.
600-
const existingEnum = Array.isArray(schema.properties.batch_type.enum)
601-
? schema.properties.batch_type.enum
602-
: null;
603-
if (existingEnum) {
604-
const allowed = ['regular', 'contact'].filter((v) =>
605-
existingEnum.includes(v)
606-
);
607-
if (allowed.length) {
608-
schema.properties.batch_type.enum = allowed;
609-
schema.properties.batch_type.enumNames = allowed.map((v) =>
610-
v.toUpperCase()
611-
);
612-
}
613-
}
614-
ensureEnabled('batch_type');
615606
}
616607
}
617608

0 commit comments

Comments
 (0)