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

    ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Document Templates", MVC.Config.DocumentTemplate.Index(null), "Export");

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

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

WriteLiteral(">\r\n");

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

            
            #line default
            #line hidden
            
            #line 11 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                                

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

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

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

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

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

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

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

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

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

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

WriteLiteral(">\r\n");

            
            #line 21 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                            
            
            #line default
            #line hidden
            
            #line 21 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                              
                                var index = 0;
                                foreach (var document in Model.DocumentTemplates)
                                {

            
            #line default
            #line hidden
WriteLiteral("                                    <tr>\r\n                                       " +
" <td>\r\n                                            <label>\r\n                    " +
"                            <input");

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

WriteAttribute("id", Tuple.Create(" id=\"", 1302), Tuple.Create("\"", 1341)
, Tuple.Create(Tuple.Create("", 1307), Tuple.Create("Options_DocumentTemplateIds_", 1307), true)
            
            #line 28 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                       , Tuple.Create(Tuple.Create("", 1335), Tuple.Create<System.Object, System.Int32>(index
            
            #line default
            #line hidden
, 1335), false)
);

WriteLiteral(" name=\"Options.DocumentTemplateIds\"");

WriteAttribute("value", Tuple.Create(" value=\"", 1377), Tuple.Create("\"", 1397)
            
            #line 28 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                                                                         , Tuple.Create(Tuple.Create("", 1385), Tuple.Create<System.Object, System.Int32>(document.Id
            
            #line default
            #line hidden
, 1385), false)
);

WriteLiteral(" ");

            
            #line 28 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                                                                                                                                                                   Write(((bool)Model.Options.DocumentTemplateIds.Contains(document.Id)) ? "checked " : null);

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

            
            #line 29 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                                                   Write(document.Id);

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

WriteAttribute("for", Tuple.Create(" for=\"", 1766), Tuple.Create("\"", 1806)
, Tuple.Create(Tuple.Create("", 1772), Tuple.Create("Options_DocumentTemplateIds_", 1772), true)
            
            #line 33 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
    , Tuple.Create(Tuple.Create("", 1800), Tuple.Create<System.Object, System.Int32>(index
            
            #line default
            #line hidden
, 1800), false)
);

WriteLiteral(">");

            
            #line 33 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                                                                                       Write(document.Description);

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

WriteLiteral("                                            ");

            
            #line 36 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                                       Write(document.Scope);

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

            
            #line 39 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                                    index++;
                                }
                            
            
            #line default
            #line hidden
WriteLiteral("\r\n                        </table>\r\n                    </td>\r\n                </" +
"tr>\r\n                <tr>\r\n                    <th>");

            
            #line 46 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                   Write(Html.LabelFor(m => m.Options.LatestOnly));

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

WriteLiteral("                        ");

            
            #line 48 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                   Write(Html.CheckBoxFor(m => m.Options.LatestOnly));

            
            #line default
            #line hidden
WriteLiteral("\r\n                        <p>Uncheck to include all document instances.</p>\r\n    " +
"                </td>\r\n                </tr>\r\n                <tr>\r\n            " +
"        <th>");

            
            #line 53 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                   Write(Html.LabelFor(m => m.Options.Format));

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

WriteLiteral("                        ");

            
            #line 55 "..\..\Areas\Config\Views\DocumentTemplate\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 60 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
        
            
            #line default
            #line hidden
            
            #line 60 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
   Write(Html.Partial(MVC.Shared.Views._ExportFields, Model.Fields.FieldGroups));

            
            #line default
            #line hidden
            
            #line 60 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
                                                                               
    }

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

            
            #line 63 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
 if (Model.ExportId.HasValue)
{

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

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

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

WriteLiteral(" title=\"Export Document Instances\"");

WriteLiteral(">\r\n");

            
            #line 66 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
        
            
            #line default
            #line hidden
            
            #line 66 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
         if (Model.ExportResult.RecordCount == 0)
        {

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

            
            #line 69 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
        }
        else
        {

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

            
            #line 72 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
           Write(Model.ExportResult.RecordCount);

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

            
            #line 72 "..\..\Areas\Config\Views\DocumentTemplate\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=\"", 3517), Tuple.Create("\"", 3598)
            
            #line 73 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
, Tuple.Create(Tuple.Create("", 3524), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DocumentTemplate.ExportRetrieve(Model.ExportId.Value))
            
            #line default
            #line hidden
, 3524), false)
);

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

WriteLiteral("><i");

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

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

            
            #line 74 "..\..\Areas\Config\Views\DocumentTemplate\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 88 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
}

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

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

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

WriteLiteral(" title=\"Exporting Document Instances...\"");

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

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

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

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

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

WriteLiteral(">\r\n");

            
            #line 93 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
    
            
            #line default
            #line hidden
            
            #line 93 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
     if (Authorization.Has(Claims.Config.ManageSavedExports))
    {

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

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

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

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

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

            
            #line 96 "..\..\Areas\Config\Views\DocumentTemplate\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 100 "..\..\Areas\Config\Views\DocumentTemplate\Export.cshtml"
    }

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

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

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

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

WriteLiteral(@">Export Now</button>
    <script>
        $(function () {
            const $form = $('#Export_Scope').closest('form');
            let $exportingDialog = null;

            $.validator.unobtrusive.parse($form);
            $form.data(""validator"").settings.submitHandler = function () {
                const exportFieldCount = $('#Export_Fields').find('input:checked').length;

                if (exportFieldCount > 0) {

                    if (!$exportingDialog) {
                        $exportingDialog = $('#Export_Exporting').dialog({
                            width: 400,
                            height: 164,
                            resizable: false,
                            modal: true,
                            autoOpen: false
                        });
                    }
                    $exportingDialog.dialog('open');

                    $form[0].submit();
                    return;
                }

                alert('Select at least one field to export.');
            }

            $('#DocumentTemplate_Export_Button').on('click', function () {
                $form.submit();
            });
            $('#DocumentTemplate_Export_Save_Button').on('click', function () {
                $form.attr('action', $form[0].dataset.saveaction);
                $form.submit();
            });
        })
    </script>
</div>
");

        }
    }
}
#pragma warning restore 1591
