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

@{
    ViewBag.Title = "Schedules";
}


<div class="panel-heading">
    <div class="panel-title">
        <h2>Sync schedules</h2>

        <div class="text-right">
            <a href="@Url.Action("CreateSchedule", "SyncSchedules")" 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 table-bordered">
       <thead>
           <tr>
               <th>
                   Schedule ID
               </th>
               <th>
                   Name
               </th>
               <th>
                   Sequence
               </th>
               <th>
                   Start
               </th>
               <th>
                   Time period (min)
               </th>
               <th class="text-center">
                   Active
               </th>
               <th class="text-center">
                   Default schedule
               </th>
               <th></th>
               <th></th>
               <th></th>
           </tr>
       </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.anQId)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.acName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.anSequence)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.adSyncStartTime)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.anTimePeriod)
                    </td>
                    @if (item.abActive)
                    {
                        <td class="text-success text-center">
                            <i class="glyphicon glyphicon-ok"></i>
                        </td>
                    }
                    else
                    {
                        <td class="text-danger text-center">
                            <i class="glyphicon glyphicon-remove"></i>
                        </td>
                    }
                    @if (item.abIsDefault)
                    {
                        <td class="text-success text-center">
                            <i class="glyphicon glyphicon-ok"></i>
                        </td>
                    }
                    else
                    {
                        <td class="text-danger text-center">
                            <i class="glyphicon glyphicon-remove"></i>
                        </td>
                    }
                    <td class="text-center">
                        <a class="open-modal"
                           data-url="/SyncSchedules/ServerSchedules?scheduleId=@item.anQId" href="#"
                           data-modal-title="Server schedules">
                            <i class="glyphicon glyphicon-dashboard"></i> All
                        </a>
                    </td>
                    <td class="text-center">
                        <i class="glyphicon glyphicon-th-list"></i> @Html.ActionLink("Tables", "SegmentTables", new { scheduleId = item.anQId })
                    </td>
                    <td class="text-center">
                       <i class="glyphicon glyphicon-pencil"></i> @Html.ActionLink("Edit", "EditSchedule", new { scheduleId = item.anQId })
                    </td>
                </tr>
            }
        </tbody>
    </table>

</div>