#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Disco.Web.Views.Device
{
    using System;
    using System.Collections.Generic;
    
    #line 3 "..\..\Views\Device\ImportReview.cshtml"
    using System.Data;
    
    #line default
    #line hidden
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Text;
    using System.Web;
    using System.Web.Helpers;
    using System.Web.Mvc;
    using System.Web.Mvc.Ajax;
    using System.Web.Mvc.Html;
    using System.Web.Routing;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.WebPages;
    using Disco;
    using Disco.Models.Repository;
    
    #line 2 "..\..\Views\Device\ImportReview.cshtml"
    using Disco.Models.Services.Devices.Importing;
    
    #line default
    #line hidden
    using Disco.Services;
    using Disco.Services.Authorization;
    using Disco.Services.Web;
    using Disco.Web;
    using Disco.Web.Extensions;
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
    [System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/ImportReview.cshtml")]
    public partial class ImportReview : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.ImportReviewModel>
    {
        public ImportReview()
        {
        }
        public override void Execute()
        {
            
            #line 4 "..\..\Views\Device\ImportReview.cshtml"
  
    Authorization.Require(Claims.Device.Actions.Import);

    ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), string.Format("File: {0}", Model.Context.Filename));

            
            #line default
            #line hidden
WriteLiteral("\r\n<div");

WriteLiteral(" id=\"Devices_Import_Review\"");

WriteLiteral(">\r\n\r\n    <h2>Review Pending Changes</h2>\r\n\r\n    <h3>Parsed ");

            
            #line 13 "..\..\Views\Device\ImportReview.cshtml"
          Write(Model.Context.Records.Count);

            
            #line default
            #line hidden
WriteLiteral(" Device Record");

            
            #line 13 "..\..\Views\Device\ImportReview.cshtml"
                                                     Write(Model.Context.Records.Count != 1 ? "s" : null);

            
            #line default
            #line hidden
WriteLiteral("</h3>\r\n    <h4>\r\n");

WriteLiteral("        ");

            
            #line 15 "..\..\Views\Device\ImportReview.cshtml"
   Write(Model.StatisticImportRecords);

            
            #line default
            #line hidden
WriteLiteral(" of ");

            
            #line 15 "..\..\Views\Device\ImportReview.cshtml"
                                    Write(Model.Context.Records.Count);

            
            #line default
            #line hidden
WriteLiteral(" Device");

            
            #line 15 "..\..\Views\Device\ImportReview.cshtml"
                                                                        Write(Model.Context.Records.Count != 1 ? "s" : null);

            
            #line default
            #line hidden
WriteLiteral(" are ready for import.\r\n    </h4>\r\n");

            
            #line 17 "..\..\Views\Device\ImportReview.cshtml"
    
            
            #line default
            #line hidden
            
            #line 17 "..\..\Views\Device\ImportReview.cshtml"
     if (Model.StatisticErrorRecords > 0)
    {

            
            #line default
            #line hidden
WriteLiteral("        <h4");

WriteLiteral(" class=\"field-validation-error\"");

WriteLiteral(">\r\n");

WriteLiteral("            ");

            
            #line 20 "..\..\Views\Device\ImportReview.cshtml"
        Write(Model.StatisticErrorRecords);

            
            #line default
            #line hidden
WriteLiteral(" Record");

            
            #line 20 "..\..\Views\Device\ImportReview.cshtml"
                                             Write(Model.StatisticErrorRecords != 1 ? "s" : null);

            
            #line default
            #line hidden
WriteLiteral(" will be skipped due to parse errors.\r\n        </h4>\r\n");

            
            #line 22 "..\..\Views\Device\ImportReview.cshtml"
    }

            
            #line default
            #line hidden
WriteLiteral("    <div");

WriteLiteral(" id=\"Devices_Import_Review_Navigation\"");

WriteLiteral(">\r\n        <ul");

WriteLiteral(" class=\"none\"");

WriteLiteral(">\r\n");

            
            #line 25 "..\..\Views\Device\ImportReview.cshtml"
            
            
            #line default
            #line hidden
            
            #line 25 "..\..\Views\Device\ImportReview.cshtml"
             if (Model.StatisticErrorRecords > 0)
            {
            
            #line default
            #line hidden
WriteLiteral("<li");

WriteLiteral(" class=\"actionDetached\"");

WriteLiteral(">\r\n                <input");

WriteLiteral(" id=\"Devices_Import_Review_Navigation_Error\"");

WriteLiteral(" type=\"checkbox\"");

WriteLiteral(" checked /><label");

WriteLiteral(" for=\"Devices_Import_Review_Navigation_Error\"");

WriteLiteral(">Show Errors (");

            
            #line 27 "..\..\Views\Device\ImportReview.cshtml"
                                                                                                                                                          Write(Model.StatisticErrorRecords);

            
            #line default
            #line hidden
WriteLiteral(")</label>\r\n            </li>");

            
            #line 28 "..\..\Views\Device\ImportReview.cshtml"
                 }
            
            #line default
            #line hidden
            
            #line 28 "..\..\Views\Device\ImportReview.cshtml"
                   if (Model.StatisticNewRecords > 0)
                  {
            
            #line default
            #line hidden
WriteLiteral("<li");

WriteLiteral(" class=\"actionAdded\"");

WriteLiteral(">\r\n                      <input");

WriteLiteral(" id=\"Devices_Import_Review_Navigation_New\"");

WriteLiteral(" type=\"checkbox\"");

WriteLiteral(" checked /><label");

WriteLiteral(" for=\"Devices_Import_Review_Navigation_New\"");

WriteLiteral(">Show New Devices (");

            
            #line 30 "..\..\Views\Device\ImportReview.cshtml"
                                                                                                                                                                 Write(Model.StatisticNewRecords);

            
            #line default
            #line hidden
WriteLiteral(")</label>\r\n                  </li>");

            
            #line 31 "..\..\Views\Device\ImportReview.cshtml"
                       }
            
            #line default
            #line hidden
            
            #line 31 "..\..\Views\Device\ImportReview.cshtml"
                         if (Model.StatisticModifiedRecords > 0)
                        {
            
            #line default
            #line hidden
WriteLiteral("<li");

WriteLiteral(" class=\"actionModified\"");

WriteLiteral(">\r\n                            <input");

WriteLiteral(" id=\"Devices_Import_Review_Navigation_Modified\"");

WriteLiteral(" type=\"checkbox\"");

WriteLiteral(" checked /><label");

WriteLiteral(" for=\"Devices_Import_Review_Navigation_Modified\"");

WriteLiteral(">Show Modified Devices (");

            
            #line 33 "..\..\Views\Device\ImportReview.cshtml"
                                                                                                                                                                                      Write(Model.StatisticModifiedRecords);

            
            #line default
            #line hidden
WriteLiteral(")</label>\r\n                        </li>");

            
            #line 34 "..\..\Views\Device\ImportReview.cshtml"
                             }
            
            #line default
            #line hidden
            
            #line 34 "..\..\Views\Device\ImportReview.cshtml"
                               if (Model.StatisticUnmodifiedRecords > 0)
                              {
            
            #line default
            #line hidden
WriteLiteral("<li");

WriteLiteral(" class=\"actionUnchanged\"");

WriteLiteral(">\r\n                                  <input");

WriteLiteral(" id=\"Devices_Import_Review_Navigation_Unchanged\"");

WriteLiteral(" type=\"checkbox\"");

WriteLiteral(" checked /><label");

WriteLiteral(" for=\"Devices_Import_Review_Navigation_Unchanged\"");

WriteLiteral(">Show Unchanged Devices (");

            
            #line 36 "..\..\Views\Device\ImportReview.cshtml"
                                                                                                                                                                                               Write(Model.StatisticUnmodifiedRecords);

            
            #line default
            #line hidden
WriteLiteral(")</label>\r\n                              </li>");

            
            #line 37 "..\..\Views\Device\ImportReview.cshtml"
                                   }

            
            #line default
            #line hidden
WriteLiteral(@"        </ul>
        <script>
            $(function () {
                $navigationContainer = $('#Devices_Import_Review_Navigation');
                $tableBody = $('#Devices_Import_Review_TableContainer').find('tbody');

                $navigationContainer.on('change', 'input', function () {
                    $tableBody.find('tr').show();

                    $navigationContainer.find('input').each(function () {
                        var $this = $(this);
                        var action = $this.closest('li').attr('class');
                        var records = $tableBody.find('tr.' + action);
                        if ($this.is(':checked')) {
                            records.show();
                        } else {
                            records.hide();
                        }
                    });
                });
            });
        </script>
    </div>
    <div");

WriteLiteral(" id=\"Devices_Import_Review_TableContainer\"");

WriteLiteral(">\r\n        <table");

WriteLiteral(" class=\"tableData\"");

WriteLiteral(">\r\n            <thead>\r\n                <tr>\r\n                    <th>Action</th>" +
"\r\n                    <th>Row</th>\r\n");

            
            #line 67 "..\..\Views\Device\ImportReview.cshtml"
                    
            
            #line default
            #line hidden
            
            #line 67 "..\..\Views\Device\ImportReview.cshtml"
                     foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
                    {

            
            #line default
            #line hidden
WriteLiteral("                        <th>");

            
            #line 69 "..\..\Views\Device\ImportReview.cshtml"
                        Write(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2);

            
            #line default
            #line hidden
WriteLiteral("</th>\r\n");

            
            #line 70 "..\..\Views\Device\ImportReview.cshtml"
                    }

            
            #line default
            #line hidden
WriteLiteral("                </tr>\r\n                <tr>\r\n                    <th>&nbsp;</th>\r" +
"\n                    <th>&nbsp;</th>\r\n");

            
            #line 75 "..\..\Views\Device\ImportReview.cshtml"
                    
            
            #line default
            #line hidden
            
            #line 75 "..\..\Views\Device\ImportReview.cshtml"
                     foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
                    {

            
            #line default
            #line hidden
WriteLiteral("                        <th>");

            
            #line 77 "..\..\Views\Device\ImportReview.cshtml"
                       Write(header.Name);

            
            #line default
            #line hidden
WriteLiteral("</th>\r\n");

            
            #line 78 "..\..\Views\Device\ImportReview.cshtml"
                    }

            
            #line default
            #line hidden
WriteLiteral("                </tr>\r\n            </thead>\r\n            <tbody>\r\n");

            
            #line 82 "..\..\Views\Device\ImportReview.cshtml"
                
            
            #line default
            #line hidden
            
            #line 82 "..\..\Views\Device\ImportReview.cshtml"
                 foreach (var recordEntry in Model.Context.Records.Select((r, i) => Tuple.Create(r, i)))
                {
                    var record = recordEntry.Item1;

            
            #line default
            #line hidden
WriteLiteral("                    <tr");

WriteAttribute("class", Tuple.Create(" class=\"", 4401), Tuple.Create("\"", 4437)
, Tuple.Create(Tuple.Create("", 4409), Tuple.Create("action", 4409), true)
            
            #line 85 "..\..\Views\Device\ImportReview.cshtml"
, Tuple.Create(Tuple.Create("", 4415), Tuple.Create<System.Object, System.Int32>(record.RecordAction
            
            #line default
            #line hidden
, 4415), false)
);

WriteLiteral(">\r\n                        <td");

WriteLiteral(" class=\"action\"");

WriteLiteral("><i");

WriteLiteral(" class=\"fa fa-fw\"");

WriteLiteral("></i></td>\r\n                        <td>");

            
            #line 87 "..\..\Views\Device\ImportReview.cshtml"
                        Write(recordEntry.Item2 + 1);

            
            #line default
            #line hidden
WriteLiteral("</td>\r\n");

            
            #line 88 "..\..\Views\Device\ImportReview.cshtml"
                        
            
            #line default
            #line hidden
            
            #line 88 "..\..\Views\Device\ImportReview.cshtml"
                         foreach (var field in record.Fields)
                        {
                            var friendlyValue = field.FriendlyValue;

            
            #line default
            #line hidden
WriteLiteral("                            <td");

WriteAttribute("class", Tuple.Create(" class=\"", 4765), Tuple.Create("\"", 4874)
, Tuple.Create(Tuple.Create("", 4773), Tuple.Create("header", 4773), true)
            
            #line 91 "..\..\Views\Device\ImportReview.cshtml"
, Tuple.Create(Tuple.Create("", 4779), Tuple.Create<System.Object, System.Int32>(field.FieldType
            
            #line default
            #line hidden
, 4779), false)
, Tuple.Create(Tuple.Create(" ", 4797), Tuple.Create("action", 4798), true)
            
            #line 91 "..\..\Views\Device\ImportReview.cshtml"
, Tuple.Create(Tuple.Create("", 4804), Tuple.Create<System.Object, System.Int32>(field.FieldAction.HasValue ? field.FieldAction.ToString() : "Error"
            
            #line default
            #line hidden
, 4804), false)
);

WriteLiteral(" data-previousvalue=\"");

            
            #line 91 "..\..\Views\Device\ImportReview.cshtml"
                                                                                                                                                              Write(field.FieldAction.HasValue && field.FieldAction.Value == System.Data.EntityState.Modified ? field.FriendlyPreviousValue : null);

            
            #line default
            #line hidden
WriteLiteral("\"");

WriteLiteral(">\r\n");

            
            #line 92 "..\..\Views\Device\ImportReview.cshtml"
                                
            
            #line default
            #line hidden
            
            #line 92 "..\..\Views\Device\ImportReview.cshtml"
                                 if (!field.FieldAction.HasValue)
                                {

            
            #line default
            #line hidden
WriteLiteral("                                    <span");

WriteLiteral(" class=\"errorMessage\"");

WriteLiteral("><strong>Error:</strong> ");

            
            #line 94 "..\..\Views\Device\ImportReview.cshtml"
                                                                                  Write(field.ErrorMessage);

            
            #line default
            #line hidden
WriteLiteral("</span>\r\n");

WriteLiteral("                                    <i");

WriteLiteral(" class=\"fa fa-exclamation-triangle fa-fw\"");

WriteLiteral("></i>\r\n");

            
            #line 96 "..\..\Views\Device\ImportReview.cshtml"
                                }

            
            #line default
            #line hidden
WriteLiteral("                                ");

            
            #line 97 "..\..\Views\Device\ImportReview.cshtml"
                                 if (string.IsNullOrEmpty(friendlyValue))
                                {
            
            #line default
            #line hidden
WriteLiteral("<span");

WriteLiteral(" class=\"smallMessage\"");

WriteLiteral(">&lt;None&gt;</span>");

            
            #line 98 "..\..\Views\Device\ImportReview.cshtml"
                                                                               }
                                else if (field.FieldType == DeviceImportFieldTypes.DeviceSerialNumber && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Added)
                                {
                                    
            
            #line default
            #line hidden
            
            #line 101 "..\..\Views\Device\ImportReview.cshtml"
                               Write(Html.ActionLink(friendlyValue, MVC.Device.Show((string)field.RawParsedValue), new { target="_blank" }));

            
            #line default
            #line hidden
            
            #line 101 "..\..\Views\Device\ImportReview.cshtml"
                                                                                                                                           }
                                else if (field.FieldType == DeviceImportFieldTypes.AssignedUserId && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Unchanged)
                                {
                                    
            
            #line default
            #line hidden
            
            #line 104 "..\..\Views\Device\ImportReview.cshtml"
                               Write(Html.ActionLink(friendlyValue, MVC.User.Show((string)field.RawParsedValue), new { target="_blank" }));

            
            #line default
            #line hidden
            
            #line 104 "..\..\Views\Device\ImportReview.cshtml"
                                                                                                                                         }
                                else
                                {
            
            #line default
            #line hidden
            
            #line 106 "..\..\Views\Device\ImportReview.cshtml"
                            Write(friendlyValue);

            
            #line default
            #line hidden
            
            #line 106 "..\..\Views\Device\ImportReview.cshtml"
                                               }

            
            #line default
            #line hidden
WriteLiteral("                            </td>\r\n");

            
            #line 108 "..\..\Views\Device\ImportReview.cshtml"
                        }

            
            #line default
            #line hidden
WriteLiteral("                    </tr>\r\n");

            
            #line 110 "..\..\Views\Device\ImportReview.cshtml"
                }

            
            #line default
            #line hidden
WriteLiteral("            </tbody>\r\n        </table>\r\n    </div>\r\n    <div");

WriteLiteral(" class=\"actionBar\"");

WriteLiteral(">\r\n        <a");

WriteLiteral(" id=\"Devices_Import_Review_ChangeHeaders\"");

WriteAttribute("href", Tuple.Create(" href=\"", 6568), Tuple.Create("\"", 6637)
            
            #line 115 "..\..\Views\Device\ImportReview.cshtml"
, Tuple.Create(Tuple.Create("", 6575), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Device.ImportHeaders(Model.Context.SessionId))
            
            #line default
            #line hidden
, 6575), false)
);

WriteLiteral(" class=\"button\"");

WriteLiteral("><i");

WriteLiteral(" class=\"fa fa-caret-left\"");

WriteLiteral("></i>Change Import Columns</a>\r\n");

            
            #line 116 "..\..\Views\Device\ImportReview.cshtml"
        
            
            #line default
            #line hidden
            
            #line 116 "..\..\Views\Device\ImportReview.cshtml"
         if (Model.StatisticImportRecords == 0)
        {

            
            #line default
            #line hidden
WriteLiteral("            <a");

WriteLiteral(" id=\"Devices_Import_Review_Apply\"");

WriteLiteral(" href=\"#\"");

WriteLiteral(" class=\"button disabled\"");

WriteLiteral(" disabled><i");

WriteLiteral(" class=\"fa fa-wrench\"");

WriteLiteral("></i>Apply Device Import</a>\r\n");

            
            #line 119 "..\..\Views\Device\ImportReview.cshtml"
        }
        else
        {

            
            #line default
            #line hidden
WriteLiteral("            <a");

WriteLiteral(" id=\"Devices_Import_Review_Apply\"");

WriteAttribute("href", Tuple.Create(" href=\"", 6999), Tuple.Create("\"", 7070)
            
            #line 122 "..\..\Views\Device\ImportReview.cshtml"
, Tuple.Create(Tuple.Create("", 7006), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ImportApply(Model.Context.SessionId))
            
            #line default
            #line hidden
, 7006), false)
);

WriteLiteral(" class=\"button\"");

WriteLiteral("><i");

WriteLiteral(" class=\"fa fa-wrench\"");

WriteLiteral("></i>Apply Device Import</a>\r\n");

            
            #line 123 "..\..\Views\Device\ImportReview.cshtml"
        }

            
            #line default
            #line hidden
WriteLiteral("    </div>\r\n</div>\r\n<script>\r\n    $(function () {\r\n        $Devices_Import_Review" +
"_TableContainer = $(\'#Devices_Import_Review_TableContainer\');\r\n\r\n        $Device" +
"s_Import_Review_TableContainer.find(\'tbody\').tooltip({\r\n            items: \'td.a" +
"ction, td.actionError, td.actionModified\',\r\n            content: function () {\r\n" +
"                var $this = $(this);\r\n\r\n                if ($this.hasClass(\'acti" +
"on\')) {\r\n                    var record = $(this).closest(\'tr\');\r\n\r\n            " +
"        if (record.hasClass(\'actionDetached\')) {\r\n                        return" +
" \'<strong>Error Parsing Record</strong><div>Review the record fields for details" +
" about any errors.</div><div class=\"smallMessage\">This record will be skipped.</" +
"div>\';\r\n                    } else if (record.hasClass(\'actionUnchanged\')) {\r\n  " +
"                      return \'<strong>No Changes</strong><div>No changes were fo" +
"und while parsing this record.</div><div class=\"smallMessage\">This record will b" +
"e skipped.</div>\';\r\n                    } else if (record.hasClass(\'actionModifi" +
"ed\')) {\r\n                        return \'<strong>Pending Changes</strong><div>Th" +
"is record contains changes which will be applied.</div>\';\r\n                    }" +
" else if (record.hasClass(\'actionAdded\')) {\r\n                        return \'<st" +
"rong>New Record</strong><div>This record will be imported.</div>\';\r\n            " +
"        }\r\n                } else if ($this.hasClass(\'actionError\')) {\r\n        " +
"            return $(this).find(\'span.errorMessage\').html();\r\n                } " +
"else if ($this.hasClass(\'actionModified\')) {\r\n                    var v = $(this" +
").attr(\'data-previousvalue\');\r\n                    if (v) {\r\n                   " +
"     return \'<strong>Previous Value:</strong><br />\' + v;\r\n                    }" +
" else {\r\n                        return \'<strong>Previous Value:</strong><br /><" +
"em>&lt;None&gt;</em>\';\r\n                    }\r\n                }\r\n            }," +
"\r\n            position: {\r\n                my: \"left top\",\r\n                at: " +
"\"left bottom\",\r\n                collision: \"flipfit flip\"\r\n            }\r\n      " +
"  });\r\n\r\n    });\r\n</script>\r\n");

        }
    }
}
#pragma warning restore 1591
