#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.InitialConfig
{
    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;
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
    [System.Web.WebPages.PageVirtualPathAttribute("~/Views/InitialConfig/Administrators.cshtml")]
    public partial class Administrators : Disco.Services.Web.WebViewPage<Disco.Web.Models.InitialConfig.AdministratorsModel>
    {
        public Administrators()
        {
        }
        public override void Execute()
        {
            
            #line 2 "..\..\Views\InitialConfig\Administrators.cshtml"
  
    ViewBag.Title = null;

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

            
            #line 5 "..\..\Views\InitialConfig\Administrators.cshtml"
Write(CommonHelpers.Breadcrumbs(Html.ToBreadcrumb("Initial Configuration", MVC.InitialConfig.Index(), "Disco ICT Administrators")));

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

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

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

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

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

WriteLiteral(@">
        <div>
            Disco ICT Administrators have access to the entire Disco ICT application.
            <code>Domain Admins</code> is a required member and is always included regardless of configuration.
        </div>
        <table>
            <tr>
                <td>
                    <div");

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

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

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

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

WriteLiteral(">None Associated</span>\r\n                        <ul");

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

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

WriteLiteral(">\r\n");

            
            #line 18 "..\..\Views\InitialConfig\Administrators.cshtml"
                            
            
            #line default
            #line hidden
            
            #line 18 "..\..\Views\InitialConfig\Administrators.cshtml"
                             foreach (var sg in Model.AdministratorSubjects)
                            {
                                var displayName = sg.Id == sg.Name ? sg.Id : string.Format("{0} [{1}]", sg.Name, sg.Id);

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

WriteAttribute("class", Tuple.Create(" class=\"", 1173), Tuple.Create("\"", 1213)
            
            #line 21 "..\..\Views\InitialConfig\Administrators.cshtml"
, Tuple.Create(Tuple.Create("", 1181), Tuple.Create<System.Object, System.Int32>(sg.IsGroup ? "group" : "user"
            
            #line default
            #line hidden
, 1181), false)
);

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

            
            #line 21 "..\..\Views\InitialConfig\Administrators.cshtml"
                                                                                        Write(sg.Id);

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

WriteLiteral(">");

            
            #line 21 "..\..\Views\InitialConfig\Administrators.cshtml"
                                                                                                      if (sg.IsGroup)
                                                                                                     {

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

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

WriteLiteral("></i>");

            
            #line 23 "..\..\Views\InitialConfig\Administrators.cshtml"
                                                                     
            
            #line default
            #line hidden
            
            #line 23 "..\..\Views\InitialConfig\Administrators.cshtml"
                                                                Write(displayName);

            
            #line default
            #line hidden
            
            #line 23 "..\..\Views\InitialConfig\Administrators.cshtml"
                                                                                 
                                                                                                     }
                                                                                                     else
                                                                                                     {

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

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

WriteLiteral("></i>");

            
            #line 27 "..\..\Views\InitialConfig\Administrators.cshtml"
                                                                    
            
            #line default
            #line hidden
            
            #line 27 "..\..\Views\InitialConfig\Administrators.cshtml"
                                                               Write(displayName);

            
            #line default
            #line hidden
            
            #line 27 "..\..\Views\InitialConfig\Administrators.cshtml"
                                                                                
                                                                                                     }
            
            #line default
            #line hidden
WriteLiteral("<i");

WriteLiteral(" class=\"fa fa-times-circle remove\"");

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

            
            #line 29 "..\..\Views\InitialConfig\Administrators.cshtml"
                            }

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

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

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

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

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

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

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

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

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

WriteLiteral(">Add</a>\r\n                    </div>\r\n                </td>\r\n            </tr>\r\n " +
"       </table>\r\n    </div>\r\n</div>\r\n<div");

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

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

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

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

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

WriteLiteral("></i>\r\n        Validating Configuration\r\n    </h2>\r\n    <div>Please wait while th" +
"e Disco ICT configuration is validated</div>\r\n</div>\r\n");

            
            #line 48 "..\..\Views\InitialConfig\Administrators.cshtml"
 using (Html.BeginForm())
{

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

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

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

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

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

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

WriteLiteral(" value=\"Continue\"");

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

            
            #line 53 "..\..\Views\InitialConfig\Administrators.cshtml"
}

            
            #line default
            #line hidden
WriteLiteral(@"<script>
    (function () {
        var container, textAdd, list, noSubjects;

        function remove() {
            $this = $(this).closest('li');

            if ($this.is('[data-subjectstatus=""new""]')) {
                $this.remove();
            } else {
                $this.attr('data-subjectstatus', 'removed').hide();
            }

            updateNoSubjects();

            return false;
        }

        function add() {
            var id = textAdd.val();

            $.ajax({
                url: '");

            
            #line 76 "..\..\Views\InitialConfig\Administrators.cshtml"
                 Write(Url.Action(MVC.InitialConfig.AdministratorsSubject()));

            
            #line default
            #line hidden
WriteLiteral("\',\r\n                method: \'post\',\r\n                data: { Id: id }\r\n          " +
"  }).done(function (response) {\r\n                if (response) {\r\n              " +
"      if (list.find(\'li[data-subjectid=\"\' + response.Id.replace(\'\\\\\', \'\\\\\\\\\') + " +
"\'\"]\').length == 0) {\r\n\r\n                        var liIcon = $(\'<i>\').addClass(\'" +
"fa fa-lg\');\r\n                        if (response.Type === \'user\')\r\n            " +
"                liIcon.addClass(\'fa-user\');\r\n                        else\r\n     " +
"                       liIcon.addClass(\'fa-users\');\r\n\r\n                        v" +
"ar li = $(\'<li>\')\r\n                            .append(liIcon)\r\n                " +
"            .append($(\'<span>\').text(response.Id == response.Name ? response.Id " +
": response.Name + \' [\' + response.Id + \']\'))\r\n                            .appen" +
"d($(\'<i>\').addClass(\'fa fa-times-circle remove\'))\r\n                            ." +
"addClass(response.Type)\r\n                            .attr(\'data-subjectid\', res" +
"ponse.Id)\r\n                            .attr(\'data-subjectstatus\', \'new\');\r\n\r\n  " +
"                      list.append(li);\r\n\r\n                        updateNoSubjec" +
"ts();\r\n                    } else {\r\n                        alert(\'That subject" +
" has already been added\');\r\n                    }\r\n                } else {\r\n   " +
"                 alert(\'Unknown Id\');\r\n                }\r\n            }).fail(fu" +
"nction (jqXHR, textStatus, errorThrown) {\r\n                alert(\'Unable to retr" +
"ieve that subject, please check the account/group and try again\');\r\n            " +
"});\r\n\r\n                return false;\r\n            }\r\n\r\n        function updateNo" +
"Subjects() {\r\n            if (list.find(\'li:visible\').length > 0)\r\n             " +
"   noSubjects.hide();\r\n            else\r\n                noSubjects.show();\r\n   " +
"     }\r\n\r\n        // Initialize Page\r\n\r\n        container = $(\'#initialConfig_Ad" +
"ministrators\');\r\n\r\n        container.on(\'click\', \'.remove\', remove);\r\n\r\n        " +
"list = $(\'#Config_AuthRoles_Subjects_Update_Dialog_List\');\r\n        noSubjects =" +
" $(\'#Config_AuthRoles_Subjects_Update_Dialog_None\');\r\n\r\n        textAdd = $(\'#Co" +
"nfig_AuthRoles_Subjects_Update_Dialog_TextAdd\');\r\n\r\n        textAdd.watermark(\'S" +
"earch Subjects\')\r\n            .autocomplete({\r\n                source: \'");

            
            #line 133 "..\..\Views\InitialConfig\Administrators.cshtml"
                     Write(Url.Action(MVC.InitialConfig.AdministratorsSearch()));

            
            #line default
            #line hidden
WriteLiteral("\',\r\n                minLength: 2,\r\n                focus: function (e, ui) {\r\n   " +
"                 textAdd.val(ui.item.Id);\r\n                    return false;\r\n  " +
"              },\r\n                select: function (e, ui) {\r\n                  " +
"  textAdd.val(ui.item.Id).blur();\r\n                    return false;\r\n          " +
"      }\r\n            }).data(\'ui-autocomplete\')._renderItem = function (ul, item" +
") {\r\n                return $(\"<li></li>\")\r\n                    .data(\"item.auto" +
"complete\", item)\r\n                    .append(\"<a><strong>\" + item.Name + \"</str" +
"ong><br>\" + item.Id + \" (\" + item.Type + \")</a>\")\r\n                    .appendTo" +
"(ul);\r\n            };\r\n\r\n        $(\'#Config_AuthRoles_Subjects_Update_Dialog_Add" +
"\').click(add);\r\n        updateNoSubjects();\r\n\r\n        $(\'#submitForm\').closest(" +
"\'form\').submit(function () {\r\n\r\n            var form = $(this);\r\n\r\n            l" +
"ist.find(\'li[data-subjectstatus!=\"removed\"]\').each(function () {\r\n              " +
"  var subjectId = $(this).attr(\'data-subjectid\');\r\n\r\n                form.append" +
"($(\'<input>\').attr({\r\n                    \'name\': \'Subjects\',\r\n                 " +
"   \'type\': \'hidden\'\r\n                }).val(subjectId));\r\n\r\n            });\r\n\r\n " +
"           $(\'#dialogWait\').dialog({\r\n                autoOpen: true,\r\n         " +
"       draggable: false,\r\n                modal: true,\r\n                resizabl" +
"e: false,\r\n                width: 400,\r\n                height: 150,\r\n          " +
"      closeOnEscape: false\r\n            }).closest(\'.ui-dialog\').find(\'.ui-dialo" +
"g-titlebar-close\').hide();\r\n        });\r\n\r\n    })();\r\n</script>\r\n");

        }
    }
}
#pragma warning restore 1591
