/
RadzenWeekView.razor.cs
98 lines (86 loc) · 2.79 KB
/
RadzenWeekView.razor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using Microsoft.AspNetCore.Components;
using Radzen.Blazor.Rendering;
using System;
namespace Radzen.Blazor
{
/// <summary>
/// Displays the appointments in a week day in <see cref="RadzenScheduler{TItem}" />
/// </summary>
/// <code>
/// <RadzenScheduler Data="@appointments">
/// <RadzenWeekView />
/// </RadzenScheduler>
/// </code>
public partial class RadzenWeekView : SchedulerViewBase
{
/// <inheritdoc />
public override string Icon => "calendar_view_week";
/// <inheritdoc />
[Parameter]
public override string Text { get; set; } = "Week";
/// <summary>
/// Gets or sets the time format.
/// </summary>
/// <value>The time format. Set to <c>h tt</c> by default.</value>
[Parameter]
public string TimeFormat { get; set; } = "h tt";
/// <summary>
/// Gets or sets the format used to display the header text.
/// </summary>
/// <value>The header text format. Set to <c>ddd</c> by default.</value>
[Parameter]
public string HeaderFormat { get; set; } = "ddd";
/// <summary>
/// Gets or sets the start time.
/// </summary>
/// <value>The start time.</value>
[Parameter]
public TimeSpan StartTime { get; set; } = TimeSpan.FromHours(8);
/// <summary>
/// Gets or sets the end time.
/// </summary>
/// <value>The end time.</value>
[Parameter]
public TimeSpan EndTime { get; set; } = TimeSpan.FromHours(24);
/// <summary>
/// Gets or sets slot size in minutes. Set to <c>30</c> by default.
/// </summary>
/// <value>The slot size in minutes.</value>
[Parameter]
public int MinutesPerSlot { get; set; } = 30;
/// <inheritdoc />
public override DateTime StartDate
{
get
{
return Scheduler.CurrentDate.Date.StartOfWeek();
}
}
/// <inheritdoc />
public override DateTime EndDate
{
get
{
return StartDate.EndOfWeek().AddDays(1);
}
}
/// <inheritdoc />
public override string Title
{
get
{
return $"{StartDate.ToString(Scheduler.Culture.DateTimeFormat.ShortDatePattern)} - {StartDate.EndOfWeek().ToString(Scheduler.Culture.DateTimeFormat.ShortDatePattern)}";
}
}
/// <inheritdoc />
public override DateTime Next()
{
return Scheduler.CurrentDate.Date.AddDays(7);
}
/// <inheritdoc />
public override DateTime Prev()
{
return Scheduler.CurrentDate.Date.AddDays(-7);
}
}
}