Skip to content

Commit e8332f0

Browse files
authored
Merge pull request #2459 from AkshataKatwal16/release-1.13.0-prod-register
Issue feat: Add select all options for userlist selection and remove sdbv select all option
2 parents ae68295 + 9ac40b3 commit e8332f0

File tree

8 files changed

+245
-167
lines changed

8 files changed

+245
-167
lines changed

apps/learner-web-app/src/app/enroll-profile-completion/page.tsx

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ import SimpleModal from '@learner/components/SimpleModal/SimpleModal';
1111
import { Box } from '@mui/material';
1212
import SignupSuccess from '@learner/components/SignupSuccess /SignupSuccess ';
1313
import { enrollUserTenant } from '@learner/utils/API/EnrollmentService';
14-
14+
declare global {
15+
interface Window {
16+
ReactNativeWebView?: {
17+
postMessage: (message: string) => void;
18+
};
19+
}
20+
}
1521
const EnrollProfileCompletionInner = () => {
1622
const router = useRouter();
1723
const [signupSuccessModal, setSignupSuccessModal] = useState(false);
@@ -72,7 +78,8 @@ const EnrollProfileCompletionInner = () => {
7278
router.push('/programs');
7379
return;
7480
}
75-
81+
82+
else{
7683
// Set localStorage values similar to callBackSwitchDialog
7784
localStorage.setItem('userId', storedUserId);
7885
localStorage.setItem('templtateId', tenantData?.templateId);
@@ -126,6 +133,7 @@ const EnrollProfileCompletionInner = () => {
126133

127134
// Show success modal instead of redirecting immediately
128135
setSignupSuccessModal(true);
136+
}
129137
} catch (error) {
130138
console.error('Failed to access program:', error);
131139
router.push('/programs');
@@ -138,8 +146,34 @@ const EnrollProfileCompletionInner = () => {
138146

139147
const onSigin = () => {
140148
setSignupSuccessModal(false);
149+
if(localStorage.getItem('isAndroidApp') === 'true')
150+
{
151+
// Send message to React Native WebView
152+
153+
const enrolledProgramData = localStorage.getItem('enrolledProgramData');
154+
155+
const program = JSON.parse(enrolledProgramData || '{}');
156+
157+
158+
if (window.ReactNativeWebView) {
159+
window.ReactNativeWebView.postMessage(JSON.stringify({
160+
type: 'ENROLL_PROGRAM_EVENT', // Event type identifier
161+
data: {
162+
userId: localStorage.getItem('userId'),
163+
tenantId: program.tenantId,
164+
token: localStorage.getItem('token'),
165+
refreshToken: localStorage.getItem('refreshToken'),
166+
167+
// Add any data you want to send
168+
}
169+
}));
170+
}
171+
}
172+
else{
173+
router.push(landingPage || '/home');
174+
175+
}
141176
// Navigate to landing page
142-
router.push(landingPage || '/home');
143177
};
144178

145179
return (

apps/learner-web-app/src/app/login/page.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,26 @@ const LoginPage = () => {
320320
} else {
321321
console.log('tenantData', tenantDataDetails);
322322
if(tenantDataDetails.length ===1) {
323+
if(localStorage.getItem('isAndroidApp') === 'true')
324+
{
325+
// Send message to React Native WebView
326+
if (window.ReactNativeWebView) {
327+
window.ReactNativeWebView.postMessage(JSON.stringify({
328+
type: 'LOGIN_INTO_ONLY_ONE_PROGRAM_EVENT', // Event type identifier
329+
data: {
330+
userId: userResponse?.userId,
331+
tenantId:selectedTenantId,
332+
token: localStorage.getItem('token'),
333+
refreshToken: localStorage.getItem('refreshToken'),
334+
335+
// Add any data you want to send
336+
}
337+
}));
338+
}
339+
}
340+
else{
323341
router.push(`${landingPage}`)
342+
}
324343
// router.push(`/programs?tenantId=${tenantDataDetails[0]?.tenantId}`);
325344
}
326345
else{

apps/learner-web-app/src/components/EnrollProgramCarousel/EnrollProgramCarousel.tsx

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ import SignupSuccess from '@learner/components/SignupSuccess /SignupSuccess ';
3030
import { getAcademicYear } from '@learner/utils/API/AcademicYearService';
3131
import { TenantName } from '@learner/utils/app.constant';
3232
import { logEvent } from '@learner/utils/googleAnalytics';
33-
33+
declare global {
34+
interface Window {
35+
ReactNativeWebView?: {
36+
postMessage: (message: string) => void;
37+
};
38+
}
39+
}
3440
interface Program {
3541
ordering: number;
3642
name: string;
@@ -242,7 +248,8 @@ const EnrollProgramCarousel = ({
242248
router.push('/login');
243249
return;
244250
}
245-
251+
252+
{
246253
try {
247254
setLoadingProgram({ id: program.tenantId, action: 'accessing' });
248255
const storedUserId = localStorage.getItem('userId');
@@ -276,9 +283,25 @@ const EnrollProgramCarousel = ({
276283
console.error('User does not have Learner role for this program');
277284
return;
278285
}
279-
286+
if(localStorage.getItem('isAndroidApp') === 'true')
287+
{
288+
// Send message to React Native WebView
289+
if (window.ReactNativeWebView) {
290+
window.ReactNativeWebView.postMessage(JSON.stringify({
291+
type: 'ACCESS_PROGRAM_EVENT', // Event type identifier
292+
data: {
293+
userId: userId,
294+
tenantId: program.tenantId,
295+
token: localStorage.getItem('token'),
296+
refreshToken: localStorage.getItem('refreshToken'),
297+
298+
// Add any data you want to send
299+
}
300+
}));
301+
}
302+
}
280303
// Set localStorage values similar to callBackSwitchDialog
281-
localStorage.setItem('userId', storedUserId);
304+
else{ localStorage.setItem('userId', storedUserId);
282305
localStorage.setItem('templtateId', tenantData?.templateId);
283306
localStorage.setItem(
284307
'userIdName',
@@ -332,12 +355,13 @@ const EnrollProgramCarousel = ({
332355
router.push(enrolledProgram?.params?.uiConfig?.landingPage || '/home');
333356
}
334357
router.push(landingPage || '/home');
358+
}
335359
} catch (error) {
336360
console.error('Failed to access program:', error);
337361
// You can add error handling/toast notification here
338362
} finally {
339363
setLoadingProgram(null);
340-
}
364+
}}
341365
};
342366

343367
const handleEnroll = async (program: Program) => {

apps/learner-web-app/src/components/pos/Layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ const App: React.FC<LayoutProps> = ({ children, ...props }) => {
231231
?.find((category: any) => category.code === 'learningForWork')
232232
?.associations?.subDomain?.sort((a: any, b: any) =>
233233
(a?.name || '').localeCompare(b?.name || '')
234-
) ?? [];
234+
)?.filter?.((item: any) => item?.code !== "employeeTraining")?? [];
235+
console.log('workSubCategory', workSubCategory);
235236
const lifeSubCategory =
236237
option
237238
?.find((category: any) => category.code === 'learningForLife')

mfes/scp-teacher-repo/public/locales/en/common.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,8 @@
10911091
"MOVED_TO_BATCH": "and moved to the batch",
10921092
"OKAY": "Okay",
10931093
"NOT_INTERESTED_TO_JOIN": "Not interested to join",
1094-
"INTERESTED_MAY_JOIN_NEXT_YEAR": "Interested, may join next year"
1094+
"INTERESTED_MAY_JOIN_NEXT_YEAR": "Interested, may join next year",
1095+
"SELECT_ALL": "Select All",
1096+
"DESELECT_ALL": "Deselect All"
10951097
}
10961098
}

mfes/scp-teacher-repo/public/locales/hi/common.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,5 +957,9 @@
957957
"IF_ANSWER_SHEET_MULTIPLE_PAGES": "• यदि उत्तर शीट में कई पृष्ठ हैं, तो प्रत्येक पृष्ठ का अलग से फोटो लें और अपलोड करें",
958958
"READ_LESS": "कम पढ़ें",
959959
"READ_MORE": "अधिक पढ़ें"
960+
},
961+
"USER_REGISTRATION": {
962+
"SELECT_ALL": "सभी का चयन करें",
963+
"DESELECT_ALL": "सभी का चयन रद्द करें"
960964
}
961965
}

0 commit comments

Comments
 (0)