How can I remove already selected slots..?
Question
Application Type
Reactive

suppose i am selecting a slot on certain date so that slot is booked by me.

when another person comes to book a slot, the slot that I booked will appear Red or Person will not be able to select that slot which is booked by me, Please provide the logic for this ..


I am attaching a screenshot which defines what exactly i want..

Thanks

  

Capture.jpg

What I would do is, have a boolean on whether a structure is booked or not. Every time, I book something, the logic behind would see if there were books already for that date, and if they were you would put on the boolean attribute, let's call it, Isbooked as active. And when you were listing the booking list, you would use that attribute to manage the enables or colours on the element that was getting the booking element. 

You first get the data slot data list, dependingn on how you are connecting a booking and a slot on your database reference, you would need to see, for each slot you would see if on that slot were already a booking, if there were you  assign the IsBooked as active, if there werent you would assign as false.

Hi @Bheeshm Raghuwanshi,

I'm not sure if you need help "hiding" the buttons but you can use multiple approaches.

Following Márcio's idea of using a Boolean "isBooked" you can set your button's Visible property to the opposite of that Boolean (will be visible when "not isBooked"). Or you can set the button to a CSS style "display: none;" when "isBooked" is true. If a red background is needed, that could also be added in CSS style using the same logic.

But please keep in mind the importance of security when selecting the best approach.

The “Visible” property on Links and Buttons controls whether or not the widget is generated as HTML and sent to the browser. If it is “false”, that control simply does not exist.

The elements with CSS “display: none;” in it (that is the same as selecting false in the Display property on Containers) means that the HTML will be sent to the browser but the Container will not be visible on the screen. Any Web Blocks in that Container will still have their Preparation / OnInitialize actions run, the needed items will be stored in viewstate, and so on.

There is where the “Visible” property of Links and Buttons is useful: for security reasons. If a user should not be able to click a link or button because they do not have access to what is behind it, it would be a bad idea to let them click it after tweaking CSS in their browser’s developer’s tools.

The “Display” property of Containers should be used when you just need the HTML of the Container to go to the screen, but the Container hidden. 


Please let me know if this has helped you in any way!

Thanks,

Fábio

Hi Bheeshm,

You just need to take an attribute with the boolean property with the Booking time. when the time has been checked/clicked you need to set the boolean value associated with its true, and depends on the boolean property you can either display them with the Css in your choice of color, say red or you can hide that block/container from UI.


Hope It helps!

Thanks



This is our Application in which in patient flow we booked an appointment and for slot we are using dropdown .

please add your logic in that..

and then kindly send the oml..

thanks

DoctorPlus.oml

Hi @Bheeshm Raghuwanshi,

without the core module, I can't see how it is being saved.

However I have some doubts about what the GetAppointmentById aggregate is being used for, if you are using the local var BookAppointment to store user's choices.


Another question is if a Doctor may work in multiple Clinics. In the GetClinicsByDocId aggregate you may get several clinics (for that DoctorId) but you only set the StartTime with the Current (it will use the first from that list).


Finally, as a best practice fetching a GetDoctorById, if you only expect 1 result, you could set Max Records to 1:


I believe you should Get all Appointments in that Clinic and for that doctor and for that chosen day. Then, when creating the Time Slot, check if that time is in that aggregate's list (you can use ListIndexOf) and if so, don't append it to the TimeSlot list.


Let me know if that made sense and if it helped you!

Thanks,

Fábio


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.