#pragma checksum "C:\Users\alestoya\Desktop\New folder (55)\TelerikAspNetCoreApp424\Views\Home\Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "296c6330dc92e9e2087e915a29a785085d3c57b7"
// <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")]
[assembly:global::Microsoft.AspNetCore.Mvc.Razor.Compilation.RazorViewAttribute(@"/Views/Home/Index.cshtml", typeof(AspNetCore.Views_Home_Index))]
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;
#line 1 "C:\Users\alestoya\Desktop\New folder (55)\TelerikAspNetCoreApp424\Views\_ViewImports.cshtml"
using TelerikAspNetCoreApp424;

#line default
#line hidden
#line 2 "C:\Users\alestoya\Desktop\New folder (55)\TelerikAspNetCoreApp424\Views\_ViewImports.cshtml"
using Kendo.Mvc.UI;

#line default
#line hidden
    [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"296c6330dc92e9e2087e915a29a785085d3c57b7", @"/Views/Home/Index.cshtml")]
    [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"c7db93cdf62b8b46b4751632b2b0df7d75bed2e0", @"/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()
        {
#line 1 "C:\Users\alestoya\Desktop\New folder (55)\TelerikAspNetCoreApp424\Views\Home\Index.cshtml"
  
    ViewData["Title"] = "Home Page";

#line default
#line hidden
            BeginContext(45, 55, true);
            WriteLiteral("\r\n<div class=\"row\">\r\n    <div class=\"col-12\">\r\n        ");
            EndContext();
            BeginContext(102, 1254, false);
#line 7 "C:\Users\alestoya\Desktop\New folder (55)\TelerikAspNetCoreApp424\Views\Home\Index.cshtml"
    Write(Html.Kendo().Grid <TelerikAspNetCoreApp424.Models.OrderViewModel>()
             .Name("grid")
             .ToolBar(tools =>
             {
                 tools.Create();
             })
             .Columns(columns =>
             {
                 columns.Bound(p => p.OrderID).Filterable(false);
                 columns.Bound(p => p.Freight);
                 columns.Bound(p => p.OrderDate).Format("{0:MM/dd/yyyy}");
                 columns.Bound(p => p.ShipName);
                 columns.Bound(p => p.ShipCity);
                 columns.Command(c => c.Edit());
             })
             .Pageable()
             .Editable(e=>e.Mode(GridEditMode.PopUp).TemplateName("CustomEditor"))
             .Sortable()
             .Scrollable()
             .Filterable()
             .HtmlAttributes(new { style = "height:550px;" })
             .DataSource(dataSource => dataSource
                 .Ajax()
                 .PageSize(20)
                 .Model(m=>m.Id(i=>i.OrderID))
                 .Events(ev=>ev.Error("onError").RequestEnd("onAddEnd"))
                 .Read(read => read.Action("Orders_Read", "Grid"))
                 .Update(read => read.Action("Orders_Update", "Grid"))
            )
        );

#line default
#line hidden
            EndContext();
            BeginContext(1357, 1793, true);
            WriteLiteral(@"
    </div>
</div>

<script>
    function onError(args) {
        var errors = args.errors;
        debugger;
        console.log(errors);
        if (errors) {
            var grid = $(""#grid"").data(""kendoGrid"");
                grid.one(""dataBinding"", function (e) {
                   e.preventDefault();
                   debugger;
                   $.each(errors, function (key, value) {
                       var message = """";
                       if ('errors' in value) {
                           $.each(value.errors, function() {
                             message += this + ""\n"";
                           });
                       }

                      
                        // As long as the key matches the field name, this line of code will be displayed as validation message in the popup.
                       grid.editable.element.find(""[data-valmsg-for='"" + key + ""']"").replaceWith('<div class=""k-tooltip k-tooltip-error k-validator-tooltip k-invalid-msg field-vali");
            WriteLiteral(@"dation-error""><span class=""k-tooltip-icon k-icon k-i-warning""></span><span class=""k-tooltip-content"">' + message + '</span><span class=""k-callout k-callout-n""></span></div>').show();
                       
                       if($(grid.editable.element).find(""[data-valmsg-for='"" + key + ""']"").length == 0){
                           $(grid.editable.element).find("".k-tooltip-error"").removeClass(""k-hidden"");
                       } 
                });
            });
        }
    }
    function onAddEnd(e) {
        //alert (e.response.Errors);
        if (e.type != ""read"" && e.response.Errors == null) {
            var grid = $(""#grid"").data(""kendoGrid"");
            console.log();
            grid.refresh();
        }
    }
</script>
");
            EndContext();
        }
        #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
