@model IEnumerable<PantheonApi.Data.DbModels.Pantheon.tPA_SyncServer>

@{
    ViewBag.Title = "ConnectedDevices";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Connected devices</h2>

@if (TempData["Disconnect-Device"] != null)
{
    <div class="alert alert-success no-border">
        <button type="button" class="close" data-dismiss="alert"><span>×</span><span class="sr-only">Close</span></button>
        <span class="text-semibold">@TempData["Disconnect-Device"]</span>
    </div>
}

<div class="table-responsive">
    <table class="table table-hover table-striped">
        <tr>
            <th>
                Device ID
            </th>
            <th>
                Document type
            </th>
            <th>
                Server
            </th>
            <th>
                Database
            </th>
            <th>
                Time period (min)
            </th>
            <th>
                Active (Yes/No)
            </th>
            <th></th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.anQId)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.acDocType)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.acServerName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.acDatabaseName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.anTimePeriod)
                </td>
                @if (item.abIsSyncEnabled != null && item.abIsSyncEnabled == true)
                {
                    <td class="text-success">
                        <i class="glyphicon glyphicon-ok"></i>
                    </td>
                }
                else
                {
                    <td class="text-danger">
                        <i class="glyphicon glyphicon-remove"></i>
                    </td>
                }
                <td>
                    @Html.ActionLink("Edit", "EditConnectedDevice", new { deviceId = item.anQId })
                </td>
            </tr>
        }
    </table>

</div>