#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.34014
//
//     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.DeviceProfile
{
    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.BI.Extensions;
    using Disco.Models.Repository;
    using Disco.Services;
    using Disco.Services.Authorization;
    
    #line 2 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
    using Disco.Services.Devices.ManagedGroups;
    
    #line default
    #line hidden
    using Disco.Services.Web;
    using Disco.Web;
    
    #line 3 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
    using Disco.Web.Areas.Config.Models.Shared;
    
    #line default
    #line hidden
    using Disco.Web.Extensions;
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
    [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceProfile/Show.cshtml")]
    public partial class Show : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceProfile.ShowModel>
    {
        public Show()
        {
        }
        public override void Execute()
        {
            
            #line 4 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
  
    Authorization.Require(Claims.Config.DeviceProfile.Show);

    ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Profiles", MVC.Config.DeviceProfile.Index(null), Model.DeviceProfile.ToString());

    var canConfig = Authorization.Has(Claims.Config.DeviceProfile.Configure);
    var canConfigExpression = Authorization.Has(Claims.Config.DeviceProfile.ConfigureComputerNameTemplate);
    var canDelete = (Authorization.Has(Claims.Config.DeviceProfile.Delete) && Model.CanDelete);

    var hideAdvanced =
        Model.DeviceProfile.AssignedUsersLinkedGroup == null &&
        Model.DeviceProfile.DevicesLinkedGroup == null;

    if (canConfig)
    {
        Html.BundleDeferred("~/Style/Fancytree");
        Html.BundleDeferred("~/ClientScripts/Modules/jQuery-Fancytree");
    }

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

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

WriteAttribute("class", Tuple.Create(" class=\"", 1034), Tuple.Create("\"", 1093)
, Tuple.Create(Tuple.Create("", 1042), Tuple.Create("form", 1042), true)
            
            #line 23 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
, Tuple.Create(Tuple.Create("", 1046), Tuple.Create<System.Object, System.Int32>(hideAdvanced ? " Config_HideAdvanced" : null
            
            #line default
            #line hidden
, 1046), false)
);

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

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

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

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

WriteLiteral("                ");

            
            #line 29 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.DisplayFor(model => model.DeviceProfile.Id));

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

            
            #line 35 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                 if (canConfig)
                {
                
            
            #line default
            #line hidden
            
            #line 37 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.TextBoxFor(model => model.DeviceProfile.Name));

            
            #line default
            #line hidden
            
            #line 37 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                   
                
            
            #line default
            #line hidden
            
            #line 38 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxSave());

            
            #line default
            #line hidden
            
            #line 38 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                       
                
            
            #line default
            #line hidden
            
            #line 39 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
            
            #line 39 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                         

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

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

WriteLiteral(@">
                    $(function () {
                        var $Name = $('#DeviceProfile_Name');
                        var $NameAjaxSave = $Name.next('.ajaxSave');
                        $Name
                            .watermark('Profile Short Name')
                            .focus(function () { $Name.select() })
                            .keydown(function (e) {
                                $NameAjaxSave.show();
                                if (e.which == 13) {
                                    $(this).blur();
                                }
                            }).blur(function () {
                                $NameAjaxSave.hide();
                            })
                            .change(function () {
                                $NameAjaxSave.hide();
                                var $ajaxLoading = $NameAjaxSave.next('.ajaxLoading').show();
                                var data = { ProfileName: $Name.val() };
                                $.ajax({
                                    url: '");

            
            #line 60 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                     Write(Url.Action(MVC.API.DeviceProfile.UpdateName(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"',
                                    dataType: 'json',
                                    data: data,
                                    success: function (d) {
                                        if (d == 'OK') {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        } else {
                                            $ajaxLoading.hide();
                                            alert('Unable to update name: ' + d);
                                        }
                                    },
                                    error: function (jqXHR, textStatus, errorThrown) {
                                        alert('Unable to update name: ' + textStatus);
                                        $ajaxLoading.hide();
                                    }
                                });
                            });
                    });
                </script>
");

            
            #line 79 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                }
                else
                {
                
            
            #line default
            #line hidden
            
            #line 82 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Model.DeviceProfile.Name);

            
            #line default
            #line hidden
            
            #line 82 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                         
                }

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

            
            #line 89 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                 if (canConfig)
                {
                
            
            #line default
            #line hidden
            
            #line 91 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.TextBoxFor(model => model.DeviceProfile.ShortName));

            
            #line default
            #line hidden
            
            #line 91 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                        
                
            
            #line default
            #line hidden
            
            #line 92 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxSave());

            
            #line default
            #line hidden
            
            #line 92 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                       
                
            
            #line default
            #line hidden
            
            #line 93 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
            
            #line 93 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                         

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

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

WriteLiteral(@">
                    $(function () {
                        var $ShortName = $('#DeviceProfile_ShortName');
                        var $ShortNameAjaxSave = $ShortName.next('.ajaxSave');
                        $ShortName
                            .watermark('Profile Short Name')
                            .focus(function () { $ShortName.select() })
                            .keydown(function (e) {
                                $ShortNameAjaxSave.show();
                                if (e.which == 13) {
                                    $(this).blur();
                                }
                            }).blur(function () {
                                $ShortNameAjaxSave.hide();
                            })
                            .change(function () {
                                $ShortNameAjaxSave.hide();
                                var $ajaxLoading = $ShortNameAjaxSave.next('.ajaxLoading').show();
                                var data = { ShortName: $ShortName.val() };
                                $.ajax({
                                    url: '");

            
            #line 114 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                     Write(Url.Action(MVC.API.DeviceProfile.UpdateShortName(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"',
                                    dataType: 'json',
                                    data: data,
                                    success: function (d) {
                                        if (d == 'OK') {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        } else {
                                            $ajaxLoading.hide();
                                            alert('Unable to update short name: ' + d);
                                        }
                                    },
                                    error: function (jqXHR, textStatus, errorThrown) {
                                        alert('Unable to update short name: ' + textStatus);
                                        $ajaxLoading.hide();
                                    }
                                });
                            });
                    });
                </script>
");

            
            #line 133 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                }
                else
                {
                
            
            #line default
            #line hidden
            
            #line 136 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Model.DeviceProfile.ShortName);

            
            #line default
            #line hidden
            
            #line 136 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                              
                }

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

            
            #line 143 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                 if (canConfig)
                {
                
            
            #line default
            #line hidden
            
            #line 145 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.TextBoxFor(model => model.DeviceProfile.Description));

            
            #line default
            #line hidden
            
            #line 145 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                          
                
            
            #line default
            #line hidden
            
            #line 146 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxSave());

            
            #line default
            #line hidden
            
            #line 146 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                       
                
            
            #line default
            #line hidden
            
            #line 147 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
            
            #line 147 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                         

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

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

WriteLiteral(@">
                    $(function () {
                        var $Description = $('#DeviceProfile_Description');
                        var $DescriptionAjaxSave = $Description.next('.ajaxSave');
                        $Description
                            .watermark('Profile Description')
                            .focus(function () { $Description.select() })
                            .keydown(function (e) {
                                $DescriptionAjaxSave.show();
                                if (e.which == 13) {
                                    $(this).blur();
                                }
                            }).blur(function () {
                                $DescriptionAjaxSave.hide();
                            })
                            .change(function () {
                                $DescriptionAjaxSave.hide();
                                var $ajaxLoading = $DescriptionAjaxSave.next('.ajaxLoading').show();
                                var data = { Description: $Description.val() };
                                $.ajax({
                                    url: '");

            
            #line 168 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                     Write(Url.Action(MVC.API.DeviceProfile.UpdateDescription(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"',
                                    dataType: 'json',
                                    data: data,
                                    success: function (d) {
                                        if (d == 'OK') {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        } else {
                                            $ajaxLoading.hide();
                                            alert('Unable to update description: ' + d);
                                        }
                                    },
                                    error: function (jqXHR, textStatus, errorThrown) {
                                        alert('Unable to update description: ' + textStatus);
                                        $ajaxLoading.hide();
                                    }
                                });
                            });
                    });
                </script>
");

            
            #line 187 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                }
                else
                {
                
            
            #line default
            #line hidden
            
            #line 190 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Model.DeviceProfile.Description);

            
            #line default
            #line hidden
            
            #line 190 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                
                }

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

            
            #line 197 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                        Write(Model.DeviceCount.ToString("n0"));

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

            
            #line 197 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                    Write(Model.DeviceCount == 1 ? "devices is a member" : "devices are members");

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

            
            #line 198 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                
            
            #line default
            #line hidden
            
            #line 198 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                 if (Model.DeviceDecommissionedCount > 0)
                {

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

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

WriteLiteral(">");

            
            #line 200 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                         Write(Model.DeviceDecommissionedCount.ToString("n0"));

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

            
            #line 200 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                          Write(Model.DeviceDecommissionedCount == 1 ? "device is" : "devices are");

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

            
            #line 201 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                }

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

            
            #line 207 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                 if (canConfig)
                {
                
            
            #line default
            #line hidden
            
            #line 209 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.DropDownList("DeviceProfile_DistributionType", Model.DeviceProfileDistributionTypes));

            
            #line default
            #line hidden
            
            #line 209 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                                          
                
            
            #line default
            #line hidden
            
            #line 210 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
            
            #line 210 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                         

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

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

WriteLiteral(@">
                    $(function () {
                        $('#DeviceProfile_DistributionType').change(function () {
                            var $this = $(this);
                            var $ajaxLoading = $this.next('.ajaxLoading').show();
                            var data = { DistributionType: $this.val() };
                            $.getJSON('");

            
            #line 217 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                  Write(Url.Action(MVC.API.DeviceProfile.UpdateDistributionType(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"', data, function (response, result) {
                                if (result != 'success' || response != 'OK') {
                                    alert('Unable to change Distribution Type:\n' + response);
                                    $ajaxLoading.hide();
                                } else {
                                    $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                }
                            });
                        });
                    });
                </script>
");

            
            #line 228 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                }
                else
                {
                
            
            #line default
            #line hidden
            
            #line 231 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Model.DeviceProfile.DistributionType.ToString());

            
            #line default
            #line hidden
            
            #line 231 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                
                }

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

            
            #line 238 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                 if (canConfig)
                {
                
            
            #line default
            #line hidden
            
            #line 240 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.DropDownListFor(m => m.DeviceProfile.DefaultOrganisationAddress, Model.OrganisationAddresses.ToSelectListItems(Model.DeviceProfile.DefaultOrganisationAddress, true, "None")));

            
            #line default
            #line hidden
            
            #line 240 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                                                                                                                                   
                
            
            #line default
            #line hidden
            
            #line 241 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
            
            #line 241 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                         

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

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

WriteLiteral(@">
                    $(function () {
                        $('#DeviceProfile_DefaultOrganisationAddress').change(function () {
                            var $this = $(this);
                            var $ajaxLoading = $this.next('.ajaxLoading').show();
                            var data = { DefaultOrganisationAddress: $this.val() };
                            $.getJSON('");

            
            #line 248 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                  Write(Url.Action(MVC.API.DeviceProfile.UpdateDefaultOrganisationAddress(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"', data, function (response, result) {
                                if (result != 'success' || response != 'OK') {
                                    alert('Unable to change Address:\n' + response);
                                    $ajaxLoading.hide();
                                } else {
                                    $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                }
                            });
                        });
                    });
                </script>
");

            
            #line 259 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                }
                else
                {
                    if (Model.DefaultOrganisationAddress == null)
                    {

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

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

WriteLiteral(">&lt;None Specified&gt;</span>\r\n");

            
            #line 265 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }
                    else
                    {
                
            
            #line default
            #line hidden
            
            #line 268 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Model.DefaultOrganisationAddress.ToString());

            
            #line default
            #line hidden
            
            #line 268 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                            
                    }
                }

            
            #line default
            #line hidden
WriteLiteral("            </td>\r\n        </tr>\r\n        <tr>\r\n            <th>Allocate Certific" +
"ates:\r\n            </th>\r\n            <td>");

            
            #line 276 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                 if (canConfig)
                {
                
            
            #line default
            #line hidden
            
            #line 278 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.DropDownListFor(model => model.DeviceProfile.CertificateProviderId, Model.CertificateProviders.ToSelectListItems(null, true, "Not Allocated")));

            
            #line default
            #line hidden
            
            #line 278 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                                                                                                    
                
            
            #line default
            #line hidden
            
            #line 279 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
            
            #line 279 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                         

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

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

WriteLiteral(@">
                    $(function () {
                        var $field = $('#DeviceProfile_CertificateProviderId');
                        var $ajaxLoading = $field.next('.ajaxLoading');
                        $field
                        .change(function () {
                            $ajaxLoading.show();
                            var data = { CertificateProviderId: $field.val() };
                            $.ajax({
                                url: '");

            
            #line 289 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                 Write(Url.Action(MVC.API.DeviceProfile.UpdateCertificateProviderId(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"',
                                dataType: 'json',
                                data: data,
                                success: function (d) {
                                    if (d == 'OK') {
                                        $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                    } else {
                                        $ajaxLoading.hide();
                                        alert('Unable to update Certificate Provider Id: ' + d);
                                    }
                                },
                                error: function (jqXHR, textStatus, errorThrown) {
                                    alert('Unable to update Certificate Provider Id: ' + textStatus);
                                    $ajaxLoading.hide();
                                }
                            });
                        });
                    });
                </script>
");

            
            #line 308 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                }
                else
                {
                    if (string.IsNullOrEmpty(Model.DeviceProfile.CertificateProviderId))
                    {

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

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

WriteLiteral(">&lt;None Allocated&gt;</span>\r\n");

            
            #line 314 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }
                    else
                    {
                        var cp = Model.CertificateProviders.FirstOrDefault(p => p.Id == Model.DeviceProfile.CertificateProviderId);
                        if (cp == null)
                        {

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

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

WriteLiteral(">&lt;None Allocated&gt;</span>\r\n");

            
            #line 321 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                        }
                        else
                        {
                
            
            #line default
            #line hidden
            
            #line 324 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(cp.Name);

            
            #line default
            #line hidden
            
            #line 324 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                        
                        }
                    }
                }

            
            #line default
            #line hidden
WriteLiteral("            </td>\r\n        </tr>\r\n        <tr>\r\n            <th>Computer Name<br " +
"/>\r\n                Template Expression:\r\n            </th>\r\n            <td>");

            
            #line 334 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                 if (canConfig && canConfigExpression)
                {
                
            
            #line default
            #line hidden
            
            #line 336 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(Html.TextBoxFor(model => model.DeviceProfile.ComputerNameTemplate));

            
            #line default
            #line hidden
            
            #line 336 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                   
                
            
            #line default
            #line hidden
            
            #line 337 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxSave());

            
            #line default
            #line hidden
            
            #line 337 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                       
                
            
            #line default
            #line hidden
            
            #line 338 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
           Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
            
            #line 338 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                         

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

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

WriteAttribute("href", Tuple.Create(" href=\"", 16557), Tuple.Create("\"", 16626)
            
            #line 339 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
, Tuple.Create(Tuple.Create("", 16564), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.DocumentTemplate.ExpressionBrowser())
            
            #line default
            #line hidden
, 16564), false)
);

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

WriteLiteral("                <script");

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

WriteLiteral(@">
                    $(function () {
                        var $ComputerNameTemplate = $('#DeviceProfile_ComputerNameTemplate');
                        var $ajaxSave = $ComputerNameTemplate.next('.ajaxSave');
                        $ComputerNameTemplate
                            .focus(function () { $ComputerNameTemplate.select() })
                            .keydown(function (e) {
                                $ajaxSave.show();
                                if (e.which == 13) {
                                    $(this).blur();
                                }
                            }).blur(function () {
                                $ajaxSave.hide();
                            })
                            .change(function () {
                                $ajaxSave.hide();
                                var $ajaxLoading = $ajaxSave.next('.ajaxLoading').show();
                                var data = { ComputerNameTemplate: $ComputerNameTemplate.val() };
                                $.ajax({
                                    url: '");

            
            #line 359 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                      Write(Url.Action(MVC.API.DeviceProfile.UpdateComputerNameTemplate(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"',
                                    dataType: 'json',
                                    data: data,
                                    success: function (d) {
                                        if (d == 'OK') {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        } else {
                                            $ajaxLoading.hide();
                                            alert('Unable to update computer name template: ' + d);
                                        }
                                    },
                                    error: function (jqXHR, textStatus, errorThrown) {
                                        alert('Unable to update computer name template: ' + textStatus);
                                        $ajaxLoading.hide();
                                    }
                                });
                            });
                    });
                </script>
");

            
            #line 378 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                }
                else
                {

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

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

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

WriteLiteral(">\r\n");

            
            #line 382 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    
            
            #line default
            #line hidden
            
            #line 382 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                     if (string.IsNullOrWhiteSpace(Model.DeviceProfile.ComputerNameTemplate))
                    {

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

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

WriteLiteral(">&lt;None Specified&gt;</span>\r\n");

            
            #line 385 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }
                    else
                    {
                        
            
            #line default
            #line hidden
            
            #line 388 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                   Write(Model.DeviceProfile.ComputerNameTemplate);

            
            #line default
            #line hidden
            
            #line 388 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                 
                    }

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

            
            #line 391 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                }

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

WriteLiteral(" style=\"margin-top: 8px;\"");

WriteLiteral(">\r\n");

            
            #line 393 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    
            
            #line default
            #line hidden
            
            #line 393 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                     if (canConfig)
                    {

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

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

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

WriteLiteral(" ");

            
            #line 395 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                            Write(Model.DeviceProfile.EnforceComputerNameConvention ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));

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

WriteLiteral("                        <script");

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

WriteLiteral(@">
                            $(function () {
                                $('#DeviceProfile_EnforceComputerNameConvention').click(function () {
                                    var $this = $(this);
                                    var $ajaxLoading = $this.nextAll('.ajaxLoading').show();
                                    var data = { EnforceComputerNameConvention: $this.is(':checked') };
                                    $.getJSON('");

            
            #line 402 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                          Write(Url.Action(MVC.API.DeviceProfile.UpdateEnforceComputerNameConvention(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"', data, function (response, result) {
                                        if (result != 'success' || response != 'OK') {
                                            alert('Unable to change Enforce Computer Name Convention:\n' + response);
                                            $ajaxLoading.hide();
                                        } else {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        }
                                    });
                                });
                            });
                        </script>
");

            
            #line 413 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }
                    else
                    {

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

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

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

WriteLiteral(" ");

            
            #line 416 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                            Write(Model.DeviceProfile.EnforceComputerNameConvention ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));

            
            #line default
            #line hidden
WriteLiteral(" disabled=\"disabled\" />\r\n");

            
            #line 417 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }

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

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

WriteLiteral(">\r\n                        Enforce Naming Convention\r\n                    </label" +
">\r\n");

WriteLiteral("                    ");

            
            #line 421 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
               Write(AjaxHelpers.AjaxLoader());

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

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

WriteLiteral(" style=\"margin-top: 8px;\"");

WriteLiteral(">\r\n                    Note: Computer names are only changed when Active Director" +
"y accounts are provisioned.\r\n                </div>\r\n            </td>\r\n        " +
"</tr>\r\n        <tr>\r\n            <th>Policies</th>\r\n            <td>\r\n          " +
"      <div>\r\n");

            
            #line 432 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    
            
            #line default
            #line hidden
            
            #line 432 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                     if (canConfig)
                    {

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

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

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

WriteLiteral(" ");

            
            #line 434 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                 Write(Model.DeviceProfile.ProvisionADAccount ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));

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

WriteLiteral("                        <script");

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

WriteLiteral(@">
                            $(function () {
                                $('#DeviceProfile_ProvisionADAccount').click(function () {
                                    var $this = $(this);
                                    var $ajaxLoading = $this.nextAll('.ajaxLoading').show();
                                    var data = { ProvisionADAccount: $this.is(':checked') };
                                    $.getJSON('");

            
            #line 441 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                          Write(Url.Action(MVC.API.DeviceProfile.UpdateProvisionADAccount(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"', data, function (response, result) {
                                        if (result != 'success' || response != 'OK') {
                                            alert('Unable to change Provision AD Account:\n' + response);
                                            $ajaxLoading.hide();
                                        } else {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        }
                                    });
                                });
                            });
                        </script>
");

            
            #line 452 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }
                    else
                    {

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

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

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

WriteLiteral(" ");

            
            #line 455 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                 Write(Model.DeviceProfile.ProvisionADAccount ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));

            
            #line default
            #line hidden
WriteLiteral(" disabled=\"disabled\" />\r\n");

            
            #line 456 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }

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

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

WriteLiteral(">\r\n                        Provision Active Directory Account\r\n                  " +
"  </label>\r\n");

WriteLiteral("                    ");

            
            #line 460 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
               Write(AjaxHelpers.AjaxLoader());

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

WriteLiteral(" style=\"margin-top: 8px;\"");

WriteLiteral(">\r\n");

            
            #line 463 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    
            
            #line default
            #line hidden
            
            #line 463 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                     if (canConfig)
                    {

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

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

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

WriteLiteral(" ");

            
            #line 465 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                     Write(Model.DeviceProfile.AssignedUserLocalAdmin ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));

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

WriteLiteral("                        <script");

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

WriteLiteral(@">
                            $(function () {
                                $('#DeviceProfile_AssignedUserLocalAdmin').click(function () {
                                    var $this = $(this);
                                    var $ajaxLoading = $this.nextAll('.ajaxLoading').show();
                                    var data = { AssignedUserLocalAdmin: $this.is(':checked') };
                                    $.getJSON('");

            
            #line 472 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                          Write(Url.Action(MVC.API.DeviceProfile.UpdateAssignedUserLocalAdmin(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"', data, function (response, result) {
                                        if (result != 'success' || response != 'OK') {
                                            alert('Unable to change Assigned User Is Local Administrator:\n' + response);
                                            $ajaxLoading.hide();
                                        } else {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        }
                                    });
                                });
                            });
                        </script>
");

            
            #line 483 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }
                    else
                    {

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

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

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

WriteLiteral(" ");

            
            #line 486 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                     Write(Model.DeviceProfile.AssignedUserLocalAdmin ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));

            
            #line default
            #line hidden
WriteLiteral(" disabled=\"disabled\" />\r\n");

            
            #line 487 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }

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

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

WriteLiteral(">\r\n                        Assigned User is Local Administrator\r\n                " +
"    </label>\r\n");

WriteLiteral("                    ");

            
            #line 491 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
               Write(AjaxHelpers.AjaxLoader());

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

WriteLiteral(" style=\"margin-top: 8px;\"");

WriteLiteral(">\r\n");

            
            #line 494 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    
            
            #line default
            #line hidden
            
            #line 494 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                     if (canConfig)
                    {

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

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

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

WriteLiteral(" ");

            
            #line 496 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                                Write(Model.DeviceProfile.AllowUntrustedReimageJobEnrolment ? new MvcHtmlString("checked=\"checked\" ") : null);

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

WriteLiteral("                        <script");

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

WriteLiteral(@">
                            $(function () {
                                $('#DeviceProfile_AllowUntrustedReimageJobEnrolment').click(function () {
                                    var $this = $(this);
                                    var $ajaxLoading = $this.nextAll('.ajaxLoading').show();
                                    var data = { AllowUntrustedReimageJobEnrolment: $this.is(':checked') };
                                    $.getJSON('");

            
            #line 503 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                          Write(Url.Action(MVC.API.DeviceProfile.UpdateAllowUntrustedReimageJobEnrolment(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"', data, function (response, result) {
                                        if (result != 'success' || response != 'OK') {
                                            alert('Unable to change Allow Untrusted Reimage Job Enrolment:\n' + response);
                                            $ajaxLoading.hide();
                                        } else {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        }
                                    });
                                });
                            });
                        </script>
");

            
            #line 514 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }
                    else
                    {

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

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

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

WriteLiteral(" ");

            
            #line 517 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                                Write(Model.DeviceProfile.AllowUntrustedReimageJobEnrolment ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));

            
            #line default
            #line hidden
WriteLiteral(" disabled=\"disabled\" />\r\n");

            
            #line 518 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }

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

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

WriteLiteral(">\r\n                        Allow Untrusted Enrolment Where a <span");

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

WriteLiteral(">\'Software - Reimage\'</span> Job is Open\r\n                    </label>\r\n");

WriteLiteral("                    ");

            
            #line 522 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
               Write(AjaxHelpers.AjaxLoader());

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

            
            #line 529 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                 if (canConfig)
                {

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

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

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

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

            
            #line 531 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                               Write(Model.DeviceProfile.OrganisationalUnit);

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

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

WriteLiteral("                        ");

            
            #line 533 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                   Write(Model.FriendlyOrganisationalUnitName);

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

WriteLiteral("                <a");

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

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

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

WriteLiteral(">Change</a>");

            
            #line 536 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                         
            
            #line default
            #line hidden
            
            #line 536 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                    Write(AjaxHelpers.AjaxLoader());

            
            #line default
            #line hidden
            
            #line 536 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                                                  

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

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

WriteLiteral(" title=\"Organisational Unit\"");

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

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

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

WriteLiteral(">\r\n");

WriteLiteral("                        ");

            
            #line 539 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                   Write(AjaxHelpers.AjaxLoader());

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

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

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

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

WriteLiteral("                <script");

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

WriteLiteral(">\r\n                    $(function () {\r\n                        var ouSetUrl = \'");

            
            #line 546 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                   Write(Url.Action(MVC.API.DeviceProfile.UpdateOrganisationalUnit(Model.DeviceProfile.Id, null, true)));

            
            #line default
            #line hidden
WriteLiteral("\';\r\n                        var ouValue = $(\'#DeviceProfile_OrganisationalUnit\')." +
"attr(\'data-value\');\r\n                        var $ouTree = null;\r\n              " +
"          var ouTree = null;\r\n                        var $dialog = null;\r\n     " +
"                   var ouSet = function (ou) {\r\n                            var " +
"url = ouSetUrl + \'&\' + $.param({ OrganisationalUnit: ou })\r\n                    " +
"        window.location.href = url;\r\n                        }\r\n                " +
"        var expandNodeTree = function (node) {\r\n                            var " +
"parent = node.parent;\r\n                            if (parent) {\r\n              " +
"                  expandNodeTree(parent);\r\n                                paren" +
"t.setExpanded(true, { noAnimation: true, noEvents: false });\r\n                  " +
"          }\r\n                        }\r\n                        var expandAndFoc" +
"usNode = function (nodeKey) {\r\n                            if (ouTree) {\r\n      " +
"                          var ouNode = ouTree.getNodeByKey(ouValue);\r\n          " +
"                      if (ouNode) {\r\n                                    expandN" +
"odeTree(ouNode);\r\n                                    ouNode.setFocus(true);\r\n  " +
"                                  ouNode.setActive(true);\r\n\r\n                   " +
"                 var li = ouNode.li;\r\n                                    var li" +
"Offset = li.offsetParent;\r\n                                    if (li.offsetTop " +
"+ li.offsetHeight > liOffset.offsetHeight)\r\n                                    " +
"    $(liOffset).animate({ \'scrollTop\': li.offsetTop - liOffset.offsetHeight + li" +
".offsetHeight + 4 }, \'fast\');\r\n                                }\r\n              " +
"              }\r\n                        }\r\n                        var ouChange" +
" = function () {\r\n                            if (!$dialog) {\r\n\r\n               " +
"                 $dialog = $(\'#dialogOrganisationalUnit\').dialog({\r\n            " +
"                        autoOpen: false,\r\n                                    bu" +
"ttons: null,\r\n                                    draggable: false,\r\n           " +
"                         modal: true,\r\n                                    resiz" +
"able: false,\r\n                                    width: 500,\r\n                 " +
"                   height: 500\r\n                                });\r\n           " +
"                     $loading = $(\'#dialogOrganisationalUnit_Loading\');\r\n       " +
"                         $loading.find(\'i.ajaxLoading\').show();\r\n\r\n             " +
"                   $ouTree = $(\'#treeOrganisationalUnit\');\r\n                    " +
"            $dialog.css(\'overflow\', \'visible\');\r\n                               " +
" $ouTree.css(\'height\', \'100%\');\r\n\r\n                                $.getJSON(\'");

            
            #line 596 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                       Write(Url.Action(MVC.API.System.DomainOrganisationalUnits()));

            
            #line default
            #line hidden
WriteLiteral("\', null, function (data) {\r\n                                    $loading.hide();\r" +
"\n\r\n                                    // Make \'Domains\' unselectable\r\n         " +
"                           $.each(data, function (i, node) {\r\n                  " +
"                      node.unselectable = true;\r\n                               " +
"     });\r\n\r\n                                    ouTree = $ouTree.fancytree({\r\n  " +
"                                      source: data,\r\n                           " +
"             checkbox: false,\r\n                                        selectMod" +
"e: 1,\r\n                                        keyboard: false,\r\n               " +
"                         fx: null\r\n                                    }).fancyt" +
"ree(\'getTree\');\r\n\r\n                                    ouTree.$container.css(\'po" +
"sition\', \'relative\');\r\n\r\n                                    // Set Buttons\r\n   " +
"                                 $dialog.dialog(\'option\', \'buttons\', {\r\n        " +
"                                \'Use Default Container\': function () {\r\n        " +
"                                    var $this = $(this);\r\n                      " +
"                      $this.css(\'overflow\', \'hidden\');\r\n                        " +
"                    $this.dialog(\"disable\");\r\n                                  " +
"          $this.dialog(\"option\", \"buttons\", null);\r\n                            " +
"                ouSet(\'\');\r\n                                        },\r\n        " +
"                                \'Save\': function () {\r\n                         " +
"                   var node = ouTree.getActiveNode();\r\n                         " +
"                   if (node && node.key.substr(0, 3).toLowerCase() == \'ou=\') {\r\n" +
"                                                var $this = $(this);\r\n          " +
"                                      $this.css(\'overflow\', \'hidden\');\r\n        " +
"                                        $this.dialog(\"disable\");\r\n              " +
"                                  $this.dialog(\"option\", \"buttons\", null);\r\n    " +
"                                            ouSet(node.key);\r\n                  " +
"                          } else {\r\n                                            " +
"    alert(\'Select an Organisational Unit to Save\')\r\n                            " +
"                }\r\n                                        }\r\n                  " +
"                  });\r\n\r\n                                    // Expand\r\n        " +
"                            expandAndFocusNode(ouValue);\r\n\r\n                    " +
"                ouTree.options.fx = { height: \"toggle\", duration: 200 };\r\n      " +
"                          });\r\n                            }\r\n                  " +
"          $dialog.dialog(\'open\');\r\n\r\n                            if (ouTree) {\r\n" +
"                                // Expand\r\n                                expan" +
"dAndFocusNode(ouValue);\r\n                            }\r\n\r\n                      " +
"      return false;\r\n                        };\r\n\r\n                        $(\'#c" +
"hangeOrganisationalUnit\').click(ouChange);\r\n                    });\r\n           " +
"     </script>\r\n");

            
            #line 656 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                }
                else
                {

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

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

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

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

WriteLiteral("                        ");

            
            #line 661 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                   Write(Model.FriendlyOrganisationalUnitName);

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

            
            #line 664 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                }

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

WriteLiteral(" style=\"margin-top: 8px;\"");

WriteLiteral(">\r\n");

            
            #line 666 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    
            
            #line default
            #line hidden
            
            #line 666 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                     if (canConfig)
                    {

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

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

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

WriteLiteral(" ");

            
            #line 668 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                        Write(Model.DeviceProfile.EnforceOrganisationalUnit ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));

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

WriteLiteral("                        <script");

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

WriteLiteral(@">
                            $(function () {
                                $('#DeviceProfile_EnforceOrganisationalUnit').click(function () {
                                    var $this = $(this);
                                    var $ajaxLoading = $this.nextAll('.ajaxLoading').show();
                                    var data = { EnforceOrganisationalUnit: $this.is(':checked') };
                                    $.getJSON('");

            
            #line 675 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                          Write(Url.Action(MVC.API.DeviceProfile.UpdateEnforceOrganisationalUnit(Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
WriteLiteral(@"', data, function (response, result) {
                                        if (result != 'success' || response != 'OK') {
                                            alert('Unable to change Enforce Organisation Unit:\n' + response);
                                            $ajaxLoading.hide();
                                        } else {
                                            $ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
                                        }
                                    });
                                });
                            });
                        </script>
");

            
            #line 686 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }
                    else
                    {

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

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

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

WriteLiteral(" ");

            
            #line 689 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                        Write(Model.DeviceProfile.EnforceOrganisationalUnit ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty));

            
            #line default
            #line hidden
WriteLiteral(" disabled=\"disabled\" />\r\n");

            
            #line 690 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    }

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

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

WriteLiteral(">\r\n                        Enforce Organisational Unit\r\n                    </lab" +
"el>\r\n");

WriteLiteral("                    ");

            
            #line 694 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
               Write(AjaxHelpers.AjaxLoader());

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

            
            #line 698 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
        
            
            #line default
            #line hidden
            
            #line 698 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
         if (hideAdvanced)
        {

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

WriteLiteral(" colspan=\"2\"");

WriteLiteral(" style=\"text-align: right;\"");

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

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

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

WriteLiteral(@">Show Advanced Options</button>
                    <script>
                        $(function () {
                            $('#Config_HideAdvanced_Show').click(function () {
                                var $this = $(this);
                                $this.closest('.Config_HideAdvanced').removeClass('Config_HideAdvanced');
                                $this.closest('tr').remove();
                            });
                        });
                    </script>
                </td>
            </tr>
");

            
            #line 714 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
        }

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

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

WriteLiteral(">\r\n            <th>Linked Groups:\r\n            </th>\r\n            <td>\r\n         " +
"       <div>\r\n");

WriteLiteral("                    ");

            
            #line 720 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
               Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel()
               {
                   CanConfigure = canConfig,
                   CategoryDescription = DeviceProfileDevicesManagedGroup.GetCategoryDescription(Model.DeviceProfile),
                   Description = DeviceProfileDevicesManagedGroup.GetDescription(Model.DeviceProfile),
                   ManagedGroup = Model.DevicesLinkedGroup,
                   UpdateUrl = Url.Action(MVC.API.DeviceProfile.UpdateDevicesLinkedGroup(Model.DeviceProfile.Id, redirect: true))
               }));

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

WriteLiteral("                    ");

            
            #line 728 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
               Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel()
               {
                   CanConfigure = canConfig,
                   CategoryDescription = DeviceProfileAssignedUsersManagedGroup.GetCategoryDescription(Model.DeviceProfile),
                   Description = DeviceProfileAssignedUsersManagedGroup.GetDescription(Model.DeviceProfile),
                   ManagedGroup = Model.AssignedUsersLinkedGroup,
                   UpdateUrl = Url.Action(MVC.API.DeviceProfile.UpdateAssignedUsersLinkedGroup(Model.DeviceProfile.Id, redirect: true))
               }));

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

            
            #line 736 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                    
            
            #line default
            #line hidden
            
            #line 736 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                     if (canConfig)
                    {
                        
            
            #line default
            #line hidden
            
            #line 738 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                   Write(Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared));

            
            #line default
            #line hidden
            
            #line 738 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                
                    }

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

            
            #line 745 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
 if (canDelete)
{

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

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

WriteLiteral(" title=\"Delete this Device Profile?\"");

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

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

WriteLiteral("></i>\r\n            This item will be permanently deleted and cannot be recovered." +
" Are you sure?\r\n        </p>\r\n    </div>\r\n");

WriteLiteral("    <script");

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

WriteLiteral(@">
        $(function () {

            var button = $('#buttonDelete');
            var buttonLink = button.attr('href');
            button.attr('href', '#');
            button.click(function () {
                $(""#dialogConfirmDelete"").dialog('open');
            });

            $(""#dialogConfirmDelete"").dialog({
                resizable: false,
                height: 140,
                modal: true,
                autoOpen: false,
                buttons: {
                    ""Delete"": function () {
                        $(this).dialog('disable');
                        window.location.href = buttonLink;
                    },
                    Cancel: function () {
                        $(this).dialog(""close"");
                    }
                }
            });

        });
    </script>
");

            
            #line 781 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
}

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

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

WriteLiteral(">\r\n");

            
            #line 783 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
    
            
            #line default
            #line hidden
            
            #line 783 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
     if (canDelete)
    { 
        
            
            #line default
            #line hidden
            
            #line 785 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
   Write(Html.ActionLinkButton("Delete", MVC.API.DeviceProfile.Delete(Model.DeviceProfile.Id, true), "buttonDelete"));

            
            #line default
            #line hidden
            
            #line 785 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                                                    
    }

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

            
            #line 787 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
     if (Authorization.Has(Claims.Device.Actions.Export))
    {
        
            
            #line default
            #line hidden
            
            #line 789 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
   Write(Html.ActionLinkButton("Export Devices", MVC.Device.Export(null, Disco.Models.Services.Devices.Exporting.DeviceExportTypes.Profile, Model.DeviceProfile.Id)));

            
            #line default
            #line hidden
            
            #line 789 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                                                                                                    
    }

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

            
            #line 791 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
     if (Authorization.Has(Claims.Device.Search) && Model.DeviceCount > 0)
    {
        
            
            #line default
            #line hidden
            
            #line 793 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
   Write(Html.ActionLinkButton(string.Format("View {0} Device{1}", Model.DeviceCount, (Model.DeviceCount != 1 ? "s" : null)), MVC.Search.Query(Model.DeviceProfile.Id.ToString(), "DeviceProfile")));

            
            #line default
            #line hidden
            
            #line 793 "..\..\Areas\Config\Views\DeviceProfile\Show.cshtml"
                                                                                                                                                                                                   
    }

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

        }
    }
}
#pragma warning restore 1591
