<EjsSchedule @ref="LookSchedule" TValue="ViewModel.Look" Height="100%" Width="100%" CurrentView="View.Month" AllowDragAndDrop="false" AllowResizing="false"
RowAutoHeight="true" FirstDayOfWeek="1" ShowQuickInfo="false" SelectedDate="@(new DateTime(2020, 2, 1))">
<ScheduleWorkHours Highlight="false" />
<ScheduleEvents TValue="ViewModel.Look" Navigating="NavigatingHandler" OnPopupClose="PopupClose" />
<ScheduleViews>
<ScheduleView Option="View.Month" />
<ScheduleView Option="View.Week">
<ScheduleViewTimeScale Interval="60" SlotCount="2" />
</ScheduleView>
<ScheduleView Option="View.Day" />
</ScheduleViews>
<ScheduleEventSettings DataSource="@DataSource" AllowAdding="false" AllowDeleting="false" EnableTooltip="true">
<Template>
@{
var entity = (context as ViewModel.Look);
<div class="template-wrap" style="background: @(entity.CategoryColor)"> // To Apply color to the appointment
<div class="subject">@($"{entity.StartTime.ToUniversalTime().ToString("hh:mm tt")} - {entity.Craft} - {entity.Status}")</div>
</div>
}
</Template>
<TooltipTemplate>
@{
var entity = (context as ViewModel.Look);
<div class="tooltip-wrap">
<div class="content-area">
<div class="name">@entity.Craft</div>
<div class="city">@entity.Site</div>
<div class="time">@($"{entity.StartTime.ToUniversalTime().ToString("hh:mm tt")} - {entity.EndTime.ToUniversalTime().ToString("hh:mm tt")}")</div>
<div class="time">@($"{TimeSpan.FromSeconds(entity.Duration).ToString(@"mm")} min")</div>
</div>
</div>
}
</TooltipTemplate>
</ScheduleEventSettings>
...
</EjsSchedule>
|
~ViewModel.cs
public class ViewModel
{
public class Look
{
public int Id { get; set; }
public string Subject { get; set; }
public string Name { get; set; }
public string Time { get; set; }
public string DateTime { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public string Status { get; set; }
public string Site { get; set; }
public string Craft { get; set; }
public double Duration { get; set; }
public string Organizations { get; set; }
public string CategoryColor { get; set; } // It is essential to add CategoryColor field to customize color
}
} |