@model IEnumerable<PantheonApi.Contracts.DataContracts.Pantheon.GetUserConnectionString>

@{
    ViewBag.Title = "ConnectionSettings";
}

<div class="panel-heading">
    <div class="panel-title">
        <h2>Connection Settings</h2>

        <div class="text-right">
            <a href="@Url.Action("CreateConnection", "SyncManager")" class="btn btn-success">
                <span class="glyphicon glyphicon-plus"></span>
            </a>
        </div>
    </div>
</div>

<div class="table-responsive">
    <table class="table table-hover table-striped">
        <tr>
            <th>
                User name
            </th>
            <th>
                Data source
            </th>
            <th>
                Initial catalog
            </th>
            <th>
                Persist security info
            </th>
            <th>
                User id
            </th>
            <th>
                Password
            </th>
            <th></th>
            <th></th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Username)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.DataSource)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.InitialCatalog)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.PersistSecurityInfo)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.UserId)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Password)
                </td>
                <td>
                    <i class="glyphicon glyphicon-info-sign" title="@item.DataLink"></i>
                </td>
                <td>
                    @if (User.IsInRole(Constants.DatalabRole))
                    {
                        @Html.ActionLink("Edit", "EditConnection", new { username = item.Username })
                    }
                </td>
            </tr>
        }
    </table>
</div>


