@using Overflow.SouthernWater @rendermode RenderMode.InteractiveAuto @inject DialogService DialogService @if (Job == null) {

Loading...

} else { } @code { RadzenScheduler scheduler; [Parameter] public SouthernWaterApiJob? Job { get; set; } [Parameter] public bool GenuineOnly { get; set; } = true; private IEnumerable Spills { get { if (GenuineOnly) { return Job.Spills.Where(j => j.status == "Genuine"); } else { return Job.Spills; } } } void OnSlotRender(SchedulerSlotRenderEventArgs args) { // // Highlight today in month view // if (args.View.Text == "Month" && args.Start.Date == DateTime.Today) // { // args.Attributes["style"] = "background: rgba(255,220,40,.2);"; // } // // // Highlight working hours (9-18) // if ((args.View.Text == "Week" || args.View.Text == "Day") && args.Start.Hour > 8 && args.Start.Hour < 19) // { // args.Attributes["style"] = "background: rgba(255,220,40,.2);"; // } } async Task OnSlotSelect(SchedulerSlotSelectEventArgs args) { // if (args.View.Text != "Year") // { // Spill data = await DialogService.OpenAsync("Add Appointment", // new Dictionary { { "Start", args.Start }, { "End", args.End } }); // // if (data != null) // { // appointments.Add(data); // // Either call the Reload method or reassign the Data property of the Scheduler // await scheduler.Reload(); // } // } } async Task OnAppointmentSelect(SchedulerAppointmentSelectEventArgs args) { _ = await DialogService.OpenAsync("View Spill", new Dictionary { { "Spill", args.Data } }); await scheduler.Reload(); } void OnAppointmentRender(SchedulerAppointmentRenderEventArgs args) { // Never call StateHasChanged in AppointmentRender - would lead to infinite loop // if (args.Data.Text == "Birthday") // { // args.Attributes["style"] = "background: red"; // } } async Task OnAppointmentMove(SchedulerAppointmentMoveEventArgs args) { // var draggedAppointment = appointments.FirstOrDefault(x => x == args.Appointment.Data); // // if (draggedAppointment != null) // { // draggedAppointment.Start = draggedAppointment.Start + args.TimeSpan; // // draggedAppointment.End = draggedAppointment.End + args.TimeSpan; // // await scheduler.Reload(); // } } }