From e54435348c5a7ec4f31b45d756c746c716a74c6a Mon Sep 17 00:00:00 2001
From: suvarnakale <suvarna.kale@tekditechnologies.com>
Date: Tue, 3 Dec 2024 22:34:15 +0530
Subject: [PATCH] Issue #000 bug:  courseType edit and timepicker on mobile
 view issues fixed

---
 src/components/PlannedSession.tsx | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/components/PlannedSession.tsx b/src/components/PlannedSession.tsx
index 103c7d6d..1374f42b 100644
--- a/src/components/PlannedSession.tsx
+++ b/src/components/PlannedSession.tsx
@@ -56,8 +56,8 @@ import SessionMode from './SessionMode';
 import { showToastMessage } from './Toastify';
 import WeekDays from './WeekDays';
 import { getOptionsByCategory } from '@/utils/Helper';
-// import { MobileTimePicker } from '@mui/x-date-pickers/MobileTimePicker';
 import { telemetryFactory } from '@/utils/telemetry';
+import { DesktopTimePicker } from '@mui/x-date-pickers/DesktopTimePicker';
 
 dayjs.extend(utc);
 dayjs.extend(timezone);
@@ -1237,10 +1237,13 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
           const sessionSubject = sessionBlocks?.[0]?.subject || '';
 
           if (
-            sessionSubject &&
-            eventData?.metadata?.subject !== sessionSubject
+            (sessionSubject &&
+              eventData?.metadata?.subject !== sessionSubject) ||
+            (selectedCourseType &&
+              eventData?.metadata?.courseType !== selectedCourseType)
           ) {
             metadata.subject = sessionSubject;
+            metadata.courseType = selectedCourseType;
             apiBody['metadata'] = metadata;
             const erMetaData = {
               topic: null,
@@ -1638,7 +1641,7 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
                     <Grid sx={{ paddingTop: '0px !important' }} item xs={6}>
                       <Box sx={{ mt: 3 }}>
                         <LocalizationProvider dateAdapter={AdapterDayjs}>
-                          <TimePicker
+                          <DesktopTimePicker
                             label={t('CENTER_SESSION.START_TIME')}
                             value={
                               editSession
@@ -1661,7 +1664,7 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
                     <Grid sx={{ paddingTop: '0px !important' }} item xs={6}>
                       <Box sx={{ mt: 3 }}>
                         <LocalizationProvider dateAdapter={AdapterDayjs}>
-                          <TimePicker
+                          <DesktopTimePicker
                             label={t('CENTER_SESSION.END_TIME')}
                             value={
                               editSession
@@ -1733,7 +1736,7 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
                 >
                   <Box sx={{ mt: 3 }}>
                     <LocalizationProvider dateAdapter={AdapterDayjs}>
-                      <TimePicker
+                      <DesktopTimePicker
                         label={t('CENTER_SESSION.START_TIME')}
                         value={
                           editSession
@@ -1760,7 +1763,7 @@ const PlannedSession: React.FC<PlannedModalProps> = ({
                 >
                   <Box sx={{ mt: 3 }}>
                     <LocalizationProvider dateAdapter={AdapterDayjs}>
-                      <TimePicker
+                      <DesktopTimePicker
                         label={t('CENTER_SESSION.END_TIME')}
                         value={
                           editSession ? endTimes[index] : block?.sessionEndTime