#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;
    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;
    using Disco.Services;
    using Disco.Services.Authorization;
    using Disco.Services.Web;
    using Disco.Web;
    using Disco.Web.Extensions;
    
    #line 1 "..\..\Views\Device\Export.cshtml"
    using Disco.Web.Models.Device;
    
    #line default
    #line hidden
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
    [System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/Export.cshtml")]
    public partial class Export : Disco.Services.Web.WebViewPage<ExportModel>
    {
        public Export()
        {
        }
        public override void Execute()
        {
            
            #line 3 "..\..\Views\Device\Export.cshtml"
  
    Authorization.RequireAny(Claims.Device.Actions.Export);

    ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Export");

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

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

WriteLiteral(">\r\n");

            
            #line 9 "..\..\Views\Device\Export.cshtml"
    
            
            #line default
            #line hidden
            
            #line 9 "..\..\Views\Device\Export.cshtml"
     using (Html.BeginForm(MVC.API.Device.Export(), FormMethod.Post, new { @data_saveaction = Url.Action(MVC.API.Device.SaveExport()) }))
    {
        
            
            #line default
            #line hidden
            
            #line 11 "..\..\Views\Device\Export.cshtml"
   Write(Html.AntiForgeryToken());

            
            #line default
            #line hidden
            
            #line 11 "..\..\Views\Device\Export.cshtml"
                                

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

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

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

WriteLiteral(" style=\"width: 570px\"");

WriteLiteral(">\r\n            <h2>Export Type</h2>\r\n            <table>\r\n                <tr>\r\n " +
"                   <th");

WriteLiteral(" style=\"width: 150px\"");

WriteLiteral(">\r\n                        Type:\r\n                    </th>\r\n                    " +
"<td>\r\n");

WriteLiteral("                        ");

            
            #line 20 "..\..\Views\Device\Export.cshtml"
                   Write(Html.DropDownListFor(m => m.Options.ExportType, Enum.GetNames(typeof(Disco.Models.Services.Devices.DeviceExportTypes)).Select(t => new SelectListItem() { Text = t, Value = t })));

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

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

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

WriteLiteral(">\r\n");

WriteLiteral("                            ");

            
            #line 22 "..\..\Views\Device\Export.cshtml"
                       Write(Html.DropDownListFor(m => m.Options.ExportTypeTargetId, Model.DeviceBatches.Select(i => new SelectListItem() { Value = i.Key.ToString(), Text = i.Value })));

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

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

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

WriteLiteral(">\r\n");

WriteLiteral("                            ");

            
            #line 25 "..\..\Views\Device\Export.cshtml"
                       Write(Html.DropDownListFor(m => m.Options.ExportTypeTargetId, Model.DeviceModels.Select(i => new SelectListItem() { Value = i.Key.ToString(), Text = i.Value })));

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

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

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

WriteLiteral(">\r\n");

WriteLiteral("                            ");

            
            #line 28 "..\..\Views\Device\Export.cshtml"
                       Write(Html.DropDownListFor(m => m.Options.ExportTypeTargetId, Model.DeviceProfiles.Select(i => new SelectListItem() { Value = i.Key.ToString(), Text = i.Value })));

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

            
            #line 33 "..\..\Views\Device\Export.cshtml"
                   Write(Html.LabelFor(m => m.Options.Format));

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

WriteLiteral("                        ");

            
            #line 35 "..\..\Views\Device\Export.cshtml"
                   Write(Html.DropDownListFor(m => m.Options.Format, Enum.GetNames(typeof(Disco.Models.Exporting.ExportFormat)).Select(v => new SelectListItem() { Value = v, Text = v })));

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

            
            #line 40 "..\..\Views\Device\Export.cshtml"
        
            
            #line default
            #line hidden
            
            #line 40 "..\..\Views\Device\Export.cshtml"
   Write(Html.Partial(MVC.Shared.Views._ExportFields, Model.Fields.FieldGroups));

            
            #line default
            #line hidden
            
            #line 40 "..\..\Views\Device\Export.cshtml"
                                                                               

            
            #line default
            #line hidden
WriteLiteral("        <script>\r\n            $(function () {\r\n                const $exportType " +
"= $(\'#Options_ExportType\');\r\n                const $exportTypeTargetContainers =" +
" $(\'#Devices_Export_Type\').find(\'.Devices_Export_Type_Target\');\r\n               " +
" const $form = $exportType.closest(\'form\');\r\n                let $exportingDialo" +
"g = null;\r\n\r\n                $exportType.on(\'change\', function () {\r\n           " +
"         $exportTypeTargetContainers.hide();\r\n                    $exportTypeTar" +
"getContainers.find(\'select\').prop(\'disabled\', true);\r\n\r\n                    swit" +
"ch ($exportType.val()) {\r\n                        case \'Batch\':\r\n               " +
"             $(\'#Devices_Export_Type_Target_Batch\').show().find(\'select\').prop(\'" +
"disabled\', false);\r\n                            break;\r\n                        " +
"case \'Profile\':\r\n                            $(\'#Devices_Export_Type_Target_Prof" +
"ile\').show().find(\'select\').prop(\'disabled\', false);\r\n                          " +
"  break;\r\n                        case \'Model\':\r\n                            $(\'" +
"#Devices_Export_Type_Target_Model\').show().find(\'select\').prop(\'disabled\', false" +
");\r\n                            break;\r\n                    }\r\n                }" +
").trigger(\'change\');\r\n\r\n                $.validator.unobtrusive.parse($form);\r\n " +
"               $form.data(\"validator\").settings.submitHandler = function () {\r\n " +
"                   const exportFieldCount = $(\'#Export_Fields\').find(\'input:chec" +
"ked\').length;\r\n                    if (exportFieldCount > 0) {\r\n                " +
"        if ($exportingDialog == null) {\r\n                            $exportingD" +
"ialog = $(\'#Export_Exporting\').dialog({\r\n                                width: " +
"400,\r\n                                height: 164,\r\n                            " +
"    resizable: false,\r\n                                modal: true,\r\n           " +
"                     autoOpen: false\r\n                            });\r\n         " +
"               }\r\n                        $exportingDialog.dialog(\'open\');\r\n\r\n  " +
"                      $form[0].submit();\r\n                        return;\r\n     " +
"               }\r\n\r\n                    alert(\'Select at least one field to expo" +
"rt.\');\r\n                };\r\n\r\n                $(\'#Devices_Export_Button\').on(\'cl" +
"ick\', function () {\r\n                    $form.submit();\r\n                });\r\n " +
"               $(\'#Devices_Export_Save_Button\').on(\'click\', function () {\r\n     " +
"               $form.attr(\'action\', $form[0].dataset.saveaction);\r\n             " +
"       $form.submit();\r\n                });\r\n            });\r\n        </script>\r" +
"\n");

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

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

            
            #line 98 "..\..\Views\Device\Export.cshtml"
 if (Model.ExportId.HasValue)
{

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

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

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

WriteLiteral(" title=\"Export Devices\"");

WriteLiteral(">\r\n");

            
            #line 101 "..\..\Views\Device\Export.cshtml"
        
            
            #line default
            #line hidden
            
            #line 101 "..\..\Views\Device\Export.cshtml"
         if (Model.ExportResult.RecordCount == 0)
        {

            
            #line default
            #line hidden
WriteLiteral("            <h4>No records matched the filter criteria</h4>\r\n");

            
            #line 104 "..\..\Views\Device\Export.cshtml"
        }
        else
        {

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

            
            #line 107 "..\..\Views\Device\Export.cshtml"
           Write(Model.ExportResult.RecordCount);

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

            
            #line 107 "..\..\Views\Device\Export.cshtml"
                                                  Write(Model.ExportResult.RecordCount != 1 ? "s" : null);

            
            #line default
            #line hidden
WriteLiteral(" were successfully exported.</h4>\r\n");

WriteLiteral("            <a");

WriteAttribute("href", Tuple.Create(" href=\"", 5389), Tuple.Create("\"", 5460)
            
            #line 108 "..\..\Views\Device\Export.cshtml"
, Tuple.Create(Tuple.Create("", 5396), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ExportRetrieve(Model.ExportId.Value))
            
            #line default
            #line hidden
, 5396), false)
);

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

WriteLiteral("><i");

WriteLiteral(" class=\"fa fa-download fa-lg\"");

WriteLiteral("></i>Download Device Export</a>\r\n");

            
            #line 109 "..\..\Views\Device\Export.cshtml"
        }

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

WriteLiteral(@"    <script>
        $(function () {
            $('#Export_Download_Dialog')
                .dialog({
                    width: 400,
                    height: 164,
                    resizable: false,
                    modal: true,
                    autoOpen: true
                });
        });
    </script>
");

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

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

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

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

WriteLiteral(" title=\"Exporting Devices...\"");

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

WriteLiteral(" class=\"fa fa-lg fa-cog fa-spin\"");

WriteLiteral(" title=\"Please Wait\"");

WriteLiteral("></i>Exporting devices...</h4>\r\n</div>\r\n<div");

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

WriteLiteral(">\r\n");

            
            #line 128 "..\..\Views\Device\Export.cshtml"
    
            
            #line default
            #line hidden
            
            #line 128 "..\..\Views\Device\Export.cshtml"
     if (Authorization.Has(Claims.Config.ManageSavedExports))
    {

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

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

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

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

WriteLiteral(">Save Export</button>\r\n");

            
            #line 131 "..\..\Views\Device\Export.cshtml"
    }
    else
    {

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

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

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

WriteLiteral(" disabled");

WriteLiteral(" title=\"Requires Manage Saved Exports Permission\"");

WriteLiteral(">Save Export</button>\r\n");

            
            #line 135 "..\..\Views\Device\Export.cshtml"
    }

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

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

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

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

WriteLiteral(">Export Now</button>\r\n</div>\r\n");

        }
    }
}
#pragma warning restore 1591
