@using PantheonRA.BackOffice.Models
@model PantheonRA.BackOffice.Models.PostCreateViewModel
@{
    ViewBag.Title = string.IsNullOrEmpty(Model.Id) ? Loc.CreateNewPost : Loc.EditPost;
}

@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "postForm" }))
{
    <div class="tabs-container">
        @Html.Partial("~/Views/Products/_CodeListTabNavigation.cshtml")
        <div class="tab-content">
            <div class="row buttons-tabbed">
                @Html.Partial("_FormButtons", new FormButtonsViewModel {
                    BackUrl = Url.Action("Index", "Post"),
                    SaveButtonGroup = new FormButtonGroup
                    {
                        Buttons = new List<FormButton>
                        {
                            new FormButton { Text = Loc.Save, Icon = "fa fa-save fa-lg", IsSubmit = true }
                        }
                    },
                    CreateButtonGroup = new FormButtonGroup
                    {
                        IsButtonName = true,
                        ButtonName = Loc.NewPostNumber,
                        Buttons = new List<FormButton>
                        {
                            new FormButton { Text = Loc.NewPostNumber, Icon = "fa fa-plus fa-lg", Url = @Url.Action("Create", "Products") }
                        }
                    }
                })
            </div>

            <div class="divided-content clearfix">
                <div class="divided-content-main divided-content-full">
                    <div class="form-horizontal form-md m-t-sm">
                        <div class="row">
                            <div class="col-xs-12 col-md-6 col-lg-4">
                                <div class="row">
                                    <div class="col-xs-12">
                                        <h3>@Loc.PostNumberBasicData</h3>
                                        <div class="form-group">
                                            @Html.LabelFor(model => model.Id, Loc.Code, new { @class = "col-md-3 control-label" })
                                            <div class="col-md-9">
                                                @Html.HiddenFor(model => model.IsEdit)
                                                @Html.TextBoxFor(model => model.Id,
                                                    HtmlAttributesHelper.CreateInputAttributes("form-control", "Id", Model.IsEdit ? true : false, Loc.Code, false, new { @autocomplete = "off" }))
                                                @Html.ValidationMessageFor(model => model.Id, "", new { @class = "text-danger" })
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-xs-12">
                                        <div class="form-group">
                                            @Html.LabelFor(model => model.Name, Loc.Name, new { @class = "col-md-3 control-label" })
                                            <div class="col-md-9">
                                                @Html.TextBoxFor(model => model.Name, new { @id = "Name", @class = "form-control", @placeholder = Loc.Name, @autocomplete = "off" })
                                                @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
}

@section pageScripts{
    <script>
        $(document).ready(function () {
            $('#Id').focus();

            $('.input-validation-error').parents('.form-group').addClass('has-error');
            $('.field-validation-error').addClass('text-danger');
        });
    </script>
}
