@model PantheonApi.SyncApi.Models.ServerScheduleItemVM

@{
    Layout = null;
}
<div id="ServerScheduleCreate">
    @using (Ajax.BeginForm("CreateServerSchedule", "SyncSchedules",
                        new AjaxOptions { UpdateTargetId = "ServerScheduleCreate", OnBegin = "startLoading('ServerScheduleCreate')" }))
    {
        @Html.AntiForgeryToken()

        <div class="form-horizontal">

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

            @Html.ValidationSummary(true, "", new { @class = "text-danger" })

           <div class="row">
               <input type="hidden" name="anScheduleId" value="@ViewBag.ScheduleId" />
               <div class="col-md-6">
                   <div class="form-group">
                       @Html.LabelFor(model => model.acDocType, "Doc type", htmlAttributes: new { @class = "control-label col-md-3" })
                       <div class="col-md-9">
                           @Html.EditorFor(model => model.acDocType, new { htmlAttributes = new { @class = "form-control", @maxlength="4" } })
                           @Html.ValidationMessageFor(model => model.acDocType, "", new { @class = "text-danger" })
                       </div>
                   </div>

                   <div class="form-group">
                       @Html.LabelFor(model => model.adSyncStartTime, "Start", htmlAttributes: new { @class = "control-label col-md-3" })
                       <div class="col-md-9">
                           @Html.EditorFor(model => model.adSyncStartTime, new { htmlAttributes = new { @class = "form-control datetimepicker" } })
                           @Html.ValidationMessageFor(model => model.adSyncStartTime, "", new { @class = "text-danger" })
                       </div>
                   </div>

                   <div class="form-group">
                       @Html.LabelFor(model => model.ScheduleType, "Schedule Type", htmlAttributes: new { @class = "control-label col-md-3" })
                       <div class="col-md-9">
                           <label class="col-md-12">
                               @Html.RadioButtonFor(model => model.ScheduleType, ScheduleType.Manual, htmlAttributes: new { @onchange = "scheduleType()", @checked = "checked" })
                               @ScheduleType.Manual
                           </label>
                           <label class="col-md-12">
                               @Html.RadioButtonFor(model => model.ScheduleType, ScheduleType.Daily, htmlAttributes: new { @onchange = "scheduleType()" })
                               @ScheduleType.Daily
                           </label>
                           <label class="col-md-12">
                               @Html.RadioButtonFor(model => model.ScheduleType, ScheduleType.Hourly, htmlAttributes: new { @onchange = "scheduleType()" })
                               @ScheduleType.Hourly
                           </label>
                       </div>
                   </div>
               </div>
               <div class="col-md-6 manual-schedule">
                   <div class="form-group">
                       @Html.LabelFor(model => model.adNextSyncTime, "Next sync", htmlAttributes: new { @class = "control-label col-md-3" })
                       <div class="col-md-9">
                           @Html.EditorFor(model => model.adNextSyncTime, new { htmlAttributes = new { @class = "form-control datetimepicker" } })
                           @Html.ValidationMessageFor(model => model.adNextSyncTime, "", new { @class = "text-danger" })
                       </div>
                   </div>

                   <div class="form-group">
                       @Html.LabelFor(model => model.anTimePeriod, "Time period", htmlAttributes: new { @class = "control-label col-md-3" })
                       <div class="col-md-9">
                           @Html.EditorFor(model => model.anTimePeriod, new { htmlAttributes = new { @class = "form-control" } })
                           @Html.ValidationMessageFor(model => model.anTimePeriod, "", new { @class = "text-danger" })
                       </div>
                   </div>
               </div>
           </div>

            <div class="form-group">
                <div class="text-right">
                    @Ajax.ActionLink("Cancel", "ServerSchedules", "SyncSchedules",
                   new { scheduleId = ViewBag.ScheduleId },
                new AjaxOptions
                {
                    UpdateTargetId = "ServerScheduleCreate",
                    InsertionMode = InsertionMode.Replace,
                    OnBegin = "startLoading('ServerScheduleCreate')"
                }, new { @class = "btn btn-default" })
                    <input type="submit" value="Save" class="btn btn-success" />
                </div>
            </div>
        </div>
    }
    <script>
        dateTimePicker();
        scheduleType();
    </script>
</div>