stuartridout / teamlink

TeamLink is a free Microsoft Teams Power App using Dataverse for Teams. It is a space where your team can share there whereabouts for the week ahead directly in Microsoft Teams. Users can select who they want to 'follow' and see the upcoming presences of or can view by site to see who is planning to be on site on that day. TeamLink allows you then to message to see if the person wants to meet up for a coffee ... all from the click of a button!
MIT License
50 stars 2 forks source link

Feature Request: My Calendar Weekly View #66

Open jnetode opened 1 year ago

jnetode commented 1 year ago

Hello, would it be possible to make a weekly view for the dates? Now the "My Calender" view starts today and show the next days. Since we strongly organize ourselfes in a weekly manner, it would be very helpfull to have a weekly view, starting always mondays and showing the entire week.

Thanks

digitisingsafety commented 1 year ago

I would like this feature too. It can be confusing when it starts to creep into the next working week!

digitisingsafety commented 1 year ago

I have added this feature to my own build by adding the following to the end of OnVisible for the Edit Presence and View Any Team screen:

Set(firstDate,DateAdd(Today(), -(Weekday(Today(),StartOfWeek.MondayZero)), TimeUnit.Days ));

This sets the first day as the Monday of the current week. You can find alternate code (e.g. if you want it to be a Tuesday, Wednesday, etc) here: http://powerappsguide.com/blog/post/get-dates-for-the-current-week

jnetode commented 1 year ago

Thanks a lot! That looks good. For the cherry in top of the cake, do you know how to set the current day background somehow different, just to show Today on the week days? That would be awesome!

Edit: I gave the day a border, so it helps seeing it. In the Edit Presence and View Any Team screen I have set the BorderWidth of the "lbDate_2": If( Text( ThisItem.date; DateTimeFormat.ShortDate ) = Text( Today(); DateTimeFormat.ShortDate ); 1; 0)

digitisingsafety commented 1 year ago

Your code threw up an error for me, so I altered to:

If(Text(ThisItem.date,DateTimeFormat.ShortDate) = Text(Today(),DateTimeFormat.ShortDate),1,0)

jnetode commented 1 year ago

Your code threw up an error for me, so I altered to:

If(Text(ThisItem.date,DateTimeFormat.ShortDate) = Text(Today(),DateTimeFormat.ShortDate),1,0)

That is because of regional settings. I cannot understand why on Earth MS does that, but as I understood, they respect the numeric regional settings. So I have to change commas and semi-colons in the code!

digitisingsafety commented 1 year ago

@jnetode I poached your code to alter the background color, which in my opinion has better visual impact.

On screen Edit Presence and View Any Team set TemplateFill of myCalendar_1 to:

If(Text(ThisItem.date,DateTimeFormat.ShortDate) = Text(Today(),DateTimeFormat.ShortDate), RGBA(233, 234, 246, 1), RGBA(0, 0, 0, 0) )

UPDATE: You can achieve the same for the team calendar, on the same screen, set TemplateFill of galIndividualCalendar_1 (nested within teamGallery_1) to:

If(Text(ThisItem.date,DateTimeFormat.ShortDate) = Text(Today(),DateTimeFormat.ShortDate), RGBA(233, 234, 246, 1), RGBA(0, 0, 0, 0) )

MattFuks commented 3 months ago

@digitisingsafety & @jnetode I am new to Power Apps. Can you show a screenshot of where i have to input the line of code in the OnVisible field?

digitisingsafety commented 3 months ago

@MattFuks I presume you mean to set the first day of the week to Monday? I inserted it directly under

Select(btnThisTeam);

jnetode commented 2 months ago

@digitisingsafety & @jnetode I am new to Power Apps. Can you show a screenshot of where i have to input the line of code in the OnVisible field?

Sorry, I was out for some time. Here are the changes I did:

1) Set Monday as first day:

==> Screen "SplashScreen" Property "OnVisible"

from: Set( firstDate; Today()
)

to: Set( firstDate; DateAdd( Today(); -(Weekday( Today(); StartOfWeek.MondayZero ) ); TimeUnit.Days )
)

2) Set background color of current day:

==> Screen "Edit Presence and View Any Team" ==> Object "myCalendar1 Property "TemplateFill"

If(Text(ThisItem.date,DateTimeFormat.ShortDate) = Text(Today(),DateTimeFormat.ShortDate), RGBA(233, 234, 246, 1), RGBA(0, 0, 0, 0) )

==> Screen "Edit Presence and View Any Team" ==> Object "teamGallery1" ==> Object "gallIndividualCalendar_1 Property "TemplateFill"

If(Text(ThisItem.date,DateTimeFormat.ShortDate) = Text(Today(),DateTimeFormat.ShortDate), RGBA(233, 234, 246, 1), RGBA(0, 0, 0, 0) ) (note that I use UK English settings, you may need to change commas and semi-colons)