Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

These are the codes for TimeSelect.js , Summary.js , Calendar.js and AdviserMyPage.js When I test the codes, it does work well as the user can

These are the codes for TimeSelect.js, Summary.js, Calendar.js and AdviserMyPage.js
When I test the codes, it does work well as the user can multiple select dates and times for each and then it summarize the the selected options just like how I want it to be but the user aren't able to deselect their options in case the user want to cancel some date/times so I want to make changes for this part. You dont have to rewrite every codes but please just explain in detail in which part should I change and show me the changed code.
#IMPORT SECTIONS#
const AdviserMyPage =()=>{
const [userInfo, setUserInfo]= useState({});
const [roles, setRoles]= useState([]);
const [loading, setLoading]= useState(true);
const [selectedDates, setSelectedDates]= useState([]);
const [selectedTimes, setSelectedTimes]= useState({});
const { isOpen, onOpen, onClose }= useDisclosure();
const [currentDate, setCurrentDate]= useState(null);
const handleDateSelect =(date)=>{
if (!selectedDates.some(d => d.getTime()=== date.getTime())){
setSelectedDates([...selectedDates, date]);
setCurrentDate(date);
onOpen();
}
};
const handleTimeSelect =(date, time)=>{
setSelectedTimes({
...selectedTimes,
[date]: [...(selectedTimes[date]||[]), time]
});
};
const handleFinalizeSelection =()=>{
// Replace this alert with actual handling logic like API call
alert('Consultations added:
'+ JSON.stringify(selectedTimes, null, 2));
};
#OTHER SECTIONS#
{/* Time Section */}
Add your consulting day and time
{isOpen && currentDate && (
)}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions

Question

Convert the given numeral to a numeral in base 10. 241 8

Answered: 1 week ago