Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduler New View - MultiDay #1852

Merged
merged 2 commits into from
Dec 13, 2024
Merged

Scheduler New View - MultiDay #1852

merged 2 commits into from
Dec 13, 2024

Conversation

paulo-rico
Copy link
Contributor

Working in the same way as RadzenWeekView with these exceptions -

  1. Will use actual StartDate as opposed to StartDate.StartOfWeek
  2. New property for this view NumberOfDays (defaulted to 2) that dictates how many days to show. EndDate calculated using this property. Also used for Previous / Next calculation.

Added a new demo section in the Scheduler demo page to highlight this.

Regards
Paul

@akorchev
Copy link
Collaborator

Hi @paulo-rico,

Thank you for the pull request. I have seen people requesting this before. However they wanted to set a different start day of the week. For example from Tuesday to Friday. Can this be supported at the moment?

@paulo-rico
Copy link
Contributor Author

paulo-rico commented Dec 13, 2024

Hi @akorchev

Can't see why not. It would mean that the developer would have to work out the StartDate from the given date and just set the NumberOfDays to 7. So it is possible with this.

Although, for that scenario, it would be better to have a StartDay property on the WeekView and do the calculations up front, very similar to when we added the StartMonth property to all the Year Views.

Do you want me to add that into the WeekView?

@akorchev
Copy link
Collaborator

I think this would be the better API - StartDay and EndDay instead of StartDate calculation shenanigans + NumberOfDays. This would even allow "exotic" views such as Sunday to Wednesday.

@akorchev
Copy link
Collaborator

Responding to the edits.

Maybe startday and endday should be weekview's properties. I am not so sure about the need for a multi-day view on its own if we do that. Are there any scenarios where users would need that?

@paulo-rico
Copy link
Contributor Author

paulo-rico commented Dec 13, 2024

TBH, when I was putting this together, it occurred to me that, with a couple of properties on the WeekView, we could make it way more flexible, accommodating scenarios that you mention and the scenario that prompted me to make this. The defaults for these properties rendering the WeekView that is already in place.

My major concern was that the name WeekView didn't really fit anymore. It would be more of a MultiDay view.

Personally, I would prefer not to have the additional view and to make the WeekView more flexible.

What do you think?

EDIT - Just to highlight what my scenario is. I need to be able to view just "today" and and the next two or three days. I need the ability to move missed appointments forward on a mobile. Makes the UI easier to operate. Showing seven days isn't required and makes the DragDrop harder as everything is rendered smaller.

@akorchev
Copy link
Collaborator

I need to be able to view just "today" and the next two or three days.

This is indeed a better fit for a new view - multi-day view.

@paulo-rico
Copy link
Contributor Author

paulo-rico commented Dec 13, 2024

I've been giving this some thought. Here's what I've come up with.

The MultiDayView is valid in it's own right, but I'm not happy with the code duplication. The MultiDayView is basically a copy of the WeekView with the shackles off. I still think that WeekView is a valid component, even though you can accomplish the same with the MultiDayView with some extra work from the developer.

My proposal is this -

  1. We add in the MultiDayView initially, and ensure that all is fine.
  2. At a later date, when happy that this view is behaving, we change the implementation of the WeekView so that the markup is just the MultiDayView with the shackles on, i.e., the StartDate = Scheduler.CurrentDate.Date.StartOfWeek() and NumberOfDays = 7. In theory, this should work and will resolve the code duplication.

What do you think?

@akorchev
Copy link
Collaborator

Sounds OK to me. Does this mean there is no more work to do in this PR?

@paulo-rico
Copy link
Contributor Author

It does. I've just Pushed again (clean up), removing a comment marker that's not required

@akorchev akorchev merged commit acd107b into radzenhq:master Dec 13, 2024
1 check passed
@paulo-rico
Copy link
Contributor Author

Sorry about this @akorchev

I have overlooked one thing. I haven't changed the icon for this view. It's the same as MonthView

This is what I was going to put there -

public override string Icon => "width_normal";

Are you able to change it your end, or shall I open another PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants