#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.17929
//
//     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.DeviceModel
{
    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.BI.Extensions;
    using Disco.Models.Repository;
    using Disco.Web;
    using Disco.Web.Extensions;
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")]
    [System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceModel/Show.cshtml")]
    public class Show : System.Web.Mvc.WebViewPage<Disco.Web.Areas.Config.Models.DeviceModel.ShowModel>
    {
        public Show()
        {
        }
        public override void Execute()
        {
            
            #line 2 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
  
    ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Models", MVC.Config.DeviceModel.Index(null), Model.DeviceModel.ToString());

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

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

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

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

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

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

WriteLiteral("                ");

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

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

            
            #line 19 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
           Write(Html.EditorFor(model => model.DeviceModel.Description));

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

WriteLiteral("                ");

            
            #line 20 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
           Write(AjaxHelpers.AjaxSave());

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

WriteLiteral("                ");

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

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

WriteLiteral("                ");

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

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

WriteLiteral("                ");

            
            #line 37 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
           Write(Html.DisplayFor(model => model.DeviceModel.Model));

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

WriteLiteral("                ");

            
            #line 45 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
           Write(Html.EditorFor(model => model.DeviceModel.DefaultPurchaseDate));

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

WriteLiteral("                ");

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

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

WriteLiteral("                ");

            
            #line 54 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
           Write(Html.DropDownListFor(model => model.DeviceModel.DefaultWarrantyProvider, Model.WarrantyProviders.ToSelectListItems(Model.DeviceModel.DefaultWarrantyProvider, true, "None")));

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

WriteLiteral("                ");

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

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

WriteLiteral("                ");

            
            #line 63 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
           Write(Html.DisplayFor(model => model.DeviceModel.ModelType));

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

WriteLiteral(" alt=\"Model Image\"");

WriteAttribute("src", Tuple.Create(" src=\"", 2151), Tuple.Create("\"", 2248)
            
            #line 71 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
, Tuple.Create(Tuple.Create("", 2157), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, Model.DeviceModel.ImageHash()))
            
            #line default
            #line hidden
, 2157), false)
);

WriteLiteral(" />\r\n            </td>\r\n        </tr>\r\n        <tr>\r\n            <th>\r\n          " +
"      <label");

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

WriteLiteral(">\r\n                    Update Image:\r\n                </label>\r\n            </th>" +
"\r\n            <td>\r\n");

            
            #line 81 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
                
            
            #line default
            #line hidden
            
            #line 81 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
                 using (Html.BeginForm(MVC.API.DeviceModel.Image(Model.DeviceModel.Id, true, null), FormMethod.Post, new { enctype = "multipart/form-data" }))
                {

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

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

WriteLiteral(" name=\"Image\"");

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

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

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

WriteLiteral("                    <input");

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

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

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

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

            
            #line 85 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
                }

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

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

WriteLiteral(@">
        $(function () {
            var $Description = $('#DeviceModel_Description');
            var $DescriptionAjaxSave = $Description.next('.ajaxSave');
            $Description
                    .watermark('Model 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 109 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
                             Write(Url.Action(MVC.API.DeviceModel.UpdateDescription(Model.DeviceModel.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>
    <script");

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

WriteLiteral(@">
        $(function () {
            var $dataField = $('#DeviceModel_DefaultPurchaseDate');
            var $ajaxLoading = $dataField.next('.ajaxLoading');
            var dateFieldValue = $dataField.val();
            var dateFieldChangeToken = null;
            $dataField
                .watermark('None')
                .datepicker({
                    changeYear: true,
                    changeMonth: true,
                    dateFormat: 'yy/mm/dd'
                })
                .change(function () {
                    var dateText = $dataField.val();
                    if (dateFieldValue.toLowerCase() != dateText.toLowerCase()) {
                        dateFieldValue = dateText;
                        if (dateFieldChangeToken)
                            window.clearTimeout(dateFieldChangeToken);
                        dateFieldChangeToken = window.setTimeout(function () {
                            $ajaxLoading.show();
                            var data = {};
                            data['DefaultPurchaseDate'] = dateFieldValue;
                            $.getJSON('");

            
            #line 151 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
                                   Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultPurchaseDate(Model.DeviceModel.Id)));

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

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

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

            
            #line 176 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
                             Write(Url.Action(MVC.API.DeviceModel.UpdateDefaultWarrantyProvider(Model.DeviceModel.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 default warranty provider: ' + d);
                                }
                            },
                            error: function (jqXHR, textStatus, errorThrown) {
                                alert('Unable to default warranty provider: ' + textStatus);
                                $ajaxLoading.hide();
                            }
                        });
                    });
        });
    </script>
</div>
<h2>
    Components</h2>
");

            
            #line 198 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.Partial(MVC.Config.DeviceModel.Views._DeviceComponentsTable, Model.DeviceComponentsModel));

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

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

WriteLiteral(">\r\n");

            
            #line 200 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
     
            
            #line default
            #line hidden
            
            #line 200 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
      if (Model.CanDelete)
    { 
        
            
            #line default
            #line hidden
            
            #line 202 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
   Write(Html.ActionLinkButton("Delete", MVC.API.DeviceModel.Delete(Model.DeviceModel.Id, true), "buttonDelete"));

            
            #line default
            #line hidden
            
            #line 202 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
                                                                                                                
    }

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

            
            #line 204 "..\..\Areas\Config\Views\DeviceModel\Show.cshtml"
Write(Html.ActionLinkButton("View Devices", MVC.Search.Query(Model.DeviceModel.Id.ToString(), "DeviceModel")));

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

        }
    }
}
#pragma warning restore 1591
