(
+ // this));
+ //builder.AddAttribute(rendSeq++, "Width", w);
+ //builder.AddAttribute(rendSeq++, "X", x);
+ //builder.AddAttribute(rendSeq++, "Y", y);
+ //builder.CloseComponent();
+
+ //< div class="mb-scheduler-div-appointment"
+ // draggable="true"
+ // @ondragstart="HandleDragStart"
+ // style="@styleString">
+
+ //
+ // @SchedulerAppointment.Title
+ // div >
+
+ // div >
+ builder.OpenElement(rendSeq++, "div");
+ builder.AddAttribute(rendSeq++, "class", "mb-scheduler-div-appointment");
+ builder.AddAttribute(rendSeq++, "draggable", "true");
+ builder.AddAttribute(rendSeq++, "ondragstart", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, HandleDragStart));
+ //builder.AddEventPreventDefaultAttribute(rendSeq++, "ondragstart", true);
+ //builder.AddEventStopPropagationAttribute(rendSeq++, "ondragstart", true);
+ styleStr =
+ "background: " + appt.BackgroundColor.Name + ";" +
+ "border-width: 0; " +
+ "border-radius: 4px; " +
+ "border-style: solid; " +
+ "color: " + appt.ForegroundColor.Name + ";" +
+ "top: " + y.ToString() + "px; " +
+ "left: " + x.ToString() + "px; " +
+ "position: absolute; " +
+ "width: " + w.ToString() + "px; " +
+ "height: " + h.ToString() + "px; ";
+ builder.AddAttribute(rendSeq++, "style", styleStr);
+ builder.OpenElement(rendSeq++, "div");
+ builder.AddAttribute(rendSeq++, "style", "padding: 4px; ");
+ builder.AddContent(rendSeq++, appt.Title);
+ builder.CloseComponent();
+ builder.CloseComponent();
+ }
+ }
+
+ builder.CloseElement(); // div mb-scheduler-body-outer
+
+ if (((@class != null) && (@class.Length > 0)) || ((style != null) && (style.Length > 0)))
+ {
+ builder.CloseElement(); // div class= style=
+ }
+ LoggingService.LogDebug(" BuildRenderTree completed");
+ }
+ }
+ #endregion
+
+ #region BuildScheduleTD
+ internal static string BuildScheduleTD(
+ RenderTreeBuilder builder,
+ ref int rendSeq,
+ bool isFirstColumn,
+ bool isHeaderRow,
+ bool isLastRow,
+ string rowBackgroundColorClass)
+ {
+ builder.OpenElement(rendSeq++, "td");
+ builder.AddAttribute(rendSeq++, "class", "mb-scheduler-td " + rowBackgroundColorClass);
+
+ if (isHeaderRow)
+ {
+ if (isFirstColumn)
+ {
+ // T R B L
+ return " border-width: 1px; border-style: solid; border-color: black; ";
+ }
+ else
+ {
+ // T R B
+ return " border-width: 1px 1px 1px 0px; border-style: solid; border-color: black; ";
+ }
+ }
+ else
+ {
+ if (isLastRow)
+ {
+ if (isFirstColumn)
+ {
+ // R B L
+ return " border-width: 0px 1px 1px 1px; border-style: solid; border-color: black; ";
+ }
+ else
+ {
+ // R B
+ return " border-width: 0px 1px 1px 0px; border-style: solid; border-color: black; ";
+ }
+ }
+ else
+ {
+ if (isFirstColumn)
+ {
+ // R L
+ return " border-width: 0px 1px 0px 1px; border-style: solid; border-color: black; ";
+ }
+ else
+ {
+ // R
+ return " border-width: 0px 1px 0px 0px; border-style: solid; border-color: black; ";
+ }
+ }
+ }
+ }
+ #endregion
+
+ #region ComputeAppointmentCoordinates
+
+ internal void ComputeAppointmentCoordinates(
+ MBSchedulerAppointment appt,
+ out int x,
+ out int y,
+ out int h,
+ out int w)
+ {
+ var dayOffsetTimespan = appt.StartTime.Date - StartDate;
+ x = LeftEdgeOfColumn1 + dayOffsetTimespan.Days * DayColumnWidth;
+ if (appt.Column == 2)
+ {
+ x += AppointmentColumnWidth + 2;
+ }
+
+ var timeOffsetTimespan = appt.StartTime -
+ new DateTime(appt.StartTime.Year,
+ appt.StartTime.Month,
+ appt.StartTime.Day,
+ WorkDayStart.Hour,
+ WorkDayStart.Minute,
+ 0);
+ y = timeOffsetTimespan.Hours * 4 * FifteenMinuteHeight +
+ (timeOffsetTimespan.Minutes / 15) * FifteenMinuteHeight;
+
+ var timeHeightTimespan = appt.EndTime - appt.StartTime;
+ h = timeHeightTimespan.Hours * 4 * FifteenMinuteHeight +
+ (timeHeightTimespan.Minutes / 15) * FifteenMinuteHeight;
+ w = AppointmentColumnWidth;
+ }
+
+ #endregion
+
+ #region HandleDragDrop
+
+ private async Task HandleDragDrop(DragEventArgs dea)
+ {
+ DropClass = "";
+ // Compute the day offset
+ var dayOffset =
+ (Convert.ToInt32(dea.ClientX) -
+ CurrentDragOffsetX -
+ Convert.ToInt32(TableBoundingRectangle.left) -
+ LeftEdgeOfColumn1) /
+ DayColumnWidth;
+ if (dayOffset < 0)
+ {
+ return;
+ }
+ var offset =
+ (Convert.ToInt32(dea.ClientY) -
+ CurrentDragOffsetY -
+ Convert.ToInt32(TableBoundingRectangle.top));
+ var timeOffset =
+ offset /
+ FifteenMinuteHeight;
+ //timeOffset =
+ // (dea.ClientY -
+ // dea.OffsetY -
+ // TableBoundingRectangle.top) /
+ // FifteenMinuteHeight;
+ if (timeOffset < 0)
+ {
+ return;
+ }
+
+ var delta = CurrentDragAppointment.EndTime - CurrentDragAppointment.StartTime;
+ var newAppointmentStartTime = StartDate +
+ new TimeSpan(
+ dayOffset,
+ WorkDayStart.Hour,
+ WorkDayStart.Minute + timeOffset * 15,
+ 0);
+
+ var dragInfo = new DragEndInfo
+ {
+ altKey = dea.AltKey,
+ ctrlKey = dea.CtrlKey,
+ metaKey = dea.MetaKey,
+ appointment = CurrentDragAppointment,
+ newEndTime = newAppointmentStartTime + delta,
+ newStartTime = newAppointmentStartTime
+ };
+
+ await OnDragEnd.InvokeAsync(dragInfo);
+ }
+
+ #endregion
+
+ #region HandleDragEnter
+
+ private async Task HandleDragEnter(DragEventArgs dea)
+ {
+ await Task.CompletedTask;
+ DropClass = "mb-scheduler-table-can-drop";
+ }
+
+ #endregion
+
+ #region HandleDragLeave
+
+ private async Task HandleDragLeave(DragEventArgs dea)
+ {
+ await Task.CompletedTask;
+ DropClass = "";
+ }
+
+ #endregion
+
+ #region HandleDragOver
+
+ private async Task HandleDragOver(DragEventArgs dea)
+ {
+ await Task.CompletedTask;
+
+ //dropClass = "";
+
+ //if (AllowedStatuses != null && !AllowedStatuses.Contains(Container.Payload.Status)) return;
+
+ //await Container.UpdateJobAsync(ListStatus);
+ }
+
+ #endregion
+
+ #region HandleDragStart
+
+ // this method is invoked from MBAppointment.razor.cs
+ public async Task HandleDragStart(DragEventArgs dea)
+ {
+ CurrentDragOffsetX = Convert.ToInt32(dea.OffsetX);
+ CurrentDragOffsetY = Convert.ToInt32(dea.OffsetY);
+
+ TableBoundingRectangle = await JsRuntime.InvokeAsync