@model Disco.Web.Models.Device.ShowModel
@{
    Authorization.Require(Claims.Device.ShowDetails);

    var canConfig = Authorization.Has(Claims.Device.Properties.Details);

    if (canConfig)
    {
        Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
    }
}
<div id="DeviceDetailTab-Details" class="DevicePart">
    <div id="DeviceDetailTab-DetailsContainer">
        <table class="tableData">
            <tbody>
                <tr>
                    <th>LAN MAC Address</th>
                    <td class="code">@(Model.Device.DeviceDetails.LanMacAddress() ?? "Unknown")</td>
                </tr>
                <tr>
                    <th>WLAN MAC Address</th>
                    <td class="code">@(Model.Device.DeviceDetails.WLanMacAddress() ?? "Unknown")</td>
                </tr>
                <tr>
                    <th>AC Adapter</th>
                    <td>@if (canConfig)
                        {
                        @Html.TextBox("DeviceDetail_ACAdapter", Model.Device.DeviceDetails.ACAdapter()) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader()
                        <script>
                            $(function () {
                                document.DiscoFunctions.PropertyChangeHelper($('#DeviceDetail_ACAdapter'), 'Unknown', '@Url.Action(MVC.API.Device.UpdateDetailACAdapter(Model.Device.SerialNumber, null))', 'DetailACAdapter');
                            });
                        </script>
                        }
                        else
                        {
                        @(Model.Device.DeviceDetails.ACAdapter() ?? "Unknown")
                        }
                    </td>
                </tr>
                <tr>
                    <th>Battery</th>
                    <td>@if (canConfig)
                        {
                        @Html.TextBox("DeviceDetail_Battery", Model.Device.DeviceDetails.Battery()) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader()
                        <script>
                            $(function () {
                                document.DiscoFunctions.PropertyChangeHelper($('#DeviceDetail_Battery'), 'Unknown', '@Url.Action(MVC.API.Device.UpdateDetailBattery(Model.Device.SerialNumber, null))', 'DetailBattery');
                            });
                        </script>
                        }
                        else
                        {
                        @(Model.Device.DeviceDetails.Battery() ?? "Unknown")
                        }
                    </td>
                </tr>
                <tr>
                    <th>Keyboard</th>
                    <td>@if (canConfig)
                        {
                        @Html.TextBox("DeviceDetail_Keyboard", Model.Device.DeviceDetails.Keyboard()) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader()
                        <script>
                            $(function () {
                                document.DiscoFunctions.PropertyChangeHelper($('#DeviceDetail_Keyboard'), 'Unknown', '@Url.Action(MVC.API.Device.UpdateDetailKeyboard(Model.Device.SerialNumber, null))', 'DetailKeyboard');
                            });
                        </script>
                        }
                        else
                        {
                        @(Model.Device.DeviceDetails.Keyboard() ?? "Unknown")
                        }
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <script>
        $('#DeviceDetailTabItems').append('<li><a href="#DeviceDetailTab-Details">Details</a></li>');
    </script>
</div>
