#pragma checksum "C:\Users\danchev\source\repos\TelerikAspNetCoreApp136\TelerikAspNetCoreApp136\Views\Home\Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "160faef3c1509199700f79037eb44dbda0310cf4"
// <auto-generated/>
#pragma warning disable 1591
[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.Views_Home_Index), @"mvc.1.0.view", @"/Views/Home/Index.cshtml")]
namespace AspNetCore
{
    #line hidden
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNetCore.Mvc;
    using Microsoft.AspNetCore.Mvc.Rendering;
    using Microsoft.AspNetCore.Mvc.ViewFeatures;
#nullable restore
#line 1 "C:\Users\danchev\source\repos\TelerikAspNetCoreApp136\TelerikAspNetCoreApp136\Views\_ViewImports.cshtml"
using TelerikAspNetCoreApp136;

#line default
#line hidden
#nullable disable
#nullable restore
#line 2 "C:\Users\danchev\source\repos\TelerikAspNetCoreApp136\TelerikAspNetCoreApp136\Views\_ViewImports.cshtml"
using Kendo.Mvc.UI;

#line default
#line hidden
#nullable disable
    [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"160faef3c1509199700f79037eb44dbda0310cf4", @"/Views/Home/Index.cshtml")]
    [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"ca9749c79770d78395adea51597e4da896b0f3c8", @"/Views/_ViewImports.cshtml")]
    public class Views_Home_Index : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
    {
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
#nullable restore
#line 1 "C:\Users\danchev\source\repos\TelerikAspNetCoreApp136\TelerikAspNetCoreApp136\Views\Home\Index.cshtml"
  
	ViewData["Title"] = "Home Page";

#line default
#line hidden
#nullable disable
            WriteLiteral("\r\n");
#nullable restore
#line 5 "C:\Users\danchev\source\repos\TelerikAspNetCoreApp136\TelerikAspNetCoreApp136\Views\Home\Index.cshtml"
Write(Html.Kendo().Scheduler<TelerikAspNetCoreApp136.Models.SchedulerEventModel>()
	.Name("scheduler")
	.Date(new DateTime(2019, 10, 29))
	.StartTime(new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 2, 00, 00))
	.Height(500)
	.Views(views =>
	{
		views.DayView();
		views.WeekView(weekView =>
		{
			weekView.Selected(true);
		});
		views.MonthView();
	})
    .Events(e => e.DataBound("onDataBound"))
	.DataSource(d => d
		.Model(m =>
		{
			m.Id(f => f.TaskID);
			m.Field(f => f.Title).DefaultValue("No title");
			m.Field(f => f.OwnerID).DefaultValue(1);
			m.RecurrenceId(f => f.RecurrenceID);
		})
		.Read(r => r.Url(Url.Action("Read", "Home")))
		.Create(r => r.Url(Url.Action("Create", "Home")))
		.Destroy(r => r.Url(Url.Action("Delete", "Home")))
		.Update(r => r.Url(Url.Action("Update", "Home")))
	)
);

#line default
#line hidden
#nullable disable
            WriteLiteral("\r\n<br />\r\n<br />\r\n");
#nullable restore
#line 36 "C:\Users\danchev\source\repos\TelerikAspNetCoreApp136\TelerikAspNetCoreApp136\Views\Home\Index.cshtml"
Write(Html.Kendo().Grid<TelerikAspNetCoreApp136.Models.SchedulerEventModel>()
        .Name("grid")
        .Scrollable()
        .Columns(columns => {
            columns.Bound(c => c.Title);
            columns.Bound(c => c.Description);
            columns.Bound(c => c.Start).Format("{0:yyyy/MM/dd HH:mm}");
            columns.Bound(c => c.End).Format("{0:yyyy/MM/dd HH:mm}");
        })
        .Selectable()
        .DataSource(d => d
            .Ajax()
            .Model(m => {
                m.Id(f => f.TaskID);
                m.Field(f => f.Title).DefaultValue("No title");
            })
            .Events(e => e.Error("error_handler"))
            .Read("Read_Grid", "Home")
            .Destroy("Delete", "Home")
        )
    );

#line default
#line hidden
#nullable disable
            WriteLiteral(@"

<script>
	  function onDataBound(e) {
        createDropArea(this);
    }

    function createDropArea(scheduler) {
        scheduler.view().content.kendoDropTargetArea({
            filter: "".k-scheduler-table td, .k-event"",
            drop: function (e) {
                var grid = $(""#grid"").data(""kendoGrid"");
                var scheduler = $(""#scheduler"").data(""kendoScheduler"");

                var offset = $(e.dropTarget).offset();
     
                var slot = scheduler.slotByPosition(offset.left, offset.top);
                var dataItem = grid.dataItem(grid.select());

                if (dataItem && slot) {
                    var offsetMiliseconds = new Date().getTimezoneOffset() * 60000;
                    var newEvent = {
                        title: dataItem.Title,
                        end: new Date(slot.startDate.getTime() + (dataItem.End - dataItem.Start)),
                        start: slot.startDate,
                        isAllDay: slot.isDaySlot,
  ");
            WriteLiteral(@"                      description: dataItem.Description
                    };

                    //delete current event:
                    grid.dataSource.remove(dataItem);
                    grid.dataSource.sync();
                    grid.dataSource.read();

                    //Save the new event and sync it with server:
                    scheduler.dataSource.add(newEvent);
                    scheduler.dataSource.sync();
                }

            }
        });
    }

    $(function () {
        var grid = $(""#grid"").data(""kendoGrid"");

        grid.table.kendoDraggable({
            filter: ""tbody > tr"",
            dragstart: function (e) {
				var gridRowOffset = grid.tbody.find(""tr:first"").offset();

                //add margin to position correctly the tooltip under the pointer
                $(""#dragTooltip"").css(""margin-left"", e.clientX - gridRowOffset.left - 50);
            },
            hint: function (row) {
    
                //remove old selecti");
            WriteLiteral(@"on
                row.parent().find("".k-state-selected"").each(function () {
                    $(this).removeClass(""k-state-selected"")
                })
    
                //add selected class to the current row
                row.addClass(""k-state-selected"");
    
                var dataItem = grid.dataItem(row);
    
                var tooltipHtml = ""<div class='k-event' id='dragTooltip'><div class='k-event-template'>"" +
                            kendo.format(""{0:t} - {1:t}"", dataItem.Start, dataItem.End) +
                            ""</div><div class='k-event-template'>"" + dataItem.Title +
                            ""</div></div>"";
    
                return $(tooltipHtml).css(""width"", 300);
            }
        });
    })

    function error_handler(e) {
        if (e.errors) {
            var message = ""Errors:\n"";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
   ");
            WriteLiteral(@"                     message += this + ""\n"";
                    });
                }
            });
            alert(message);

            var scheduler = $(""#scheduler"").data(""kendoScheduler"");
            scheduler.one(""dataBinding"", function (e) {
                //prevent saving if server error is thrown
                e.preventDefault();
            })
        }
    }
</script>
");
        }
        #pragma warning restore 1998
        [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
        public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
        [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
        public global::Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
        [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
        public global::Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
        [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
        public global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
        [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
        public global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
    }
}
#pragma warning restore 1591
