@model ApplyVendorModel
@{
    Layout = "_ColumnsTwo";

    //title
    NopHtml.AddTitleParts(T("PageTitle.Vendors.Apply").Text);
    //page class
    NopHtml.AppendPageCssClassParts("html-apply-vendor-page");
}
<div class="page apply-vendor-page">
    <div class="page-title panel-heading">
        <h1>@T("PageTitle.Vendors.Apply")</h1>
    </div>
    <div class="page-body">
        @await Component.InvokeAsync(typeof(TopicBlockViewComponent), new { systemName = "ApplyVendor" })
        @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.ApplyVendorTop, additionalData = Model })
        @if (Model.DisableFormInput)
        {
            <div class="result alert alert-success">
                @Model.Result
            </div>
        }
        else
        {
            <form asp-route="ApplyVendorAccount" method="post" enctype="multipart/form-data">
                <div asp-validation-summary="ModelOnly" class="message-error"></div>
                <div class="form-horizontal">
                    <div class="form-group">
                        <label class="control-label col-sm-2 col-md-2" asp-for="Name" asp-postfix=":"></label>
                        <div class="visible-xs form-title-rquired"><nop-required /></div>
                        <div class="col-sm-6 col-md-6 col-xs-12">
                            <input asp-for="Name" class="name form-control" placeholder="@T("Vendors.ApplyAccount.Name.Hint")" />
                        </div>
                        <div class="col-sm-4 col-md-4 col-xs-12">
                            <div class="visible-lg visible-md visible-sm form-title-rquired"><nop-required /></div>
                            <span asp-validation-for="Name"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-2 col-md-2" asp-for="Email" asp-postfix=":"></label>
                        <div class="visible-xs form-title-rquired"><nop-required /></div>
                        <div class="col-sm-6 col-md-6 col-xs-12">
                            <input asp-for="Email" class="name email form-control" placeholder="@T("Vendors.ApplyAccount.Email.Hint")" />
                        </div>
                        <div class="col-sm-4 col-md-4">
                            <div class="visible-lg visible-md visible-sm form-title-rquired"><nop-required /></div>
                            <span asp-validation-for="Email"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-2 col-md-2" asp-for="Description" asp-postfix=":"></label>
                        <div class="col-sm-6 col-md-6 col-xs-12">
                            <textarea asp-for="Description" class="description form-control"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-2 col-md-2">@T("Vendors.ApplyAccount.Picture"):</label>
                        <div class="col-sm-6 col-md-6">
                            <label class="btn btn-default uploads-files">
                                <input name="uploadedFile" type="file" accept="image/*" />
                            </label>
                        </div>
                    </div>
                    @await Html.PartialAsync("_VendorAttributes", Model.VendorAttributes)
                    @if (Model.DisplayCaptcha)
                    {
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-md-offset-2 col-md-4">
                                <div class="captcha-box">
                                    <nop-captcha />
                                </div>
                            </div>
                        </div>
                    }
                    @if (Model.TermsOfServiceEnabled)
                    {
                        <script asp-location="Footer">
                            $(function () {
                                $('#apply-vendor').on('click', function () {
                                    if ($('#termsofservice').is(':checked')) {
                                        //do some stuff
                                        return true;
                                    } else {
                                        //just show validation errors, dont post
                                        alert('@Html.Raw(JavaScriptEncoder.Default.Encode(T("Vendors.ApplyAccount.AcceptTermsOfService.Required").Text))');
                                        return false;
                                    }
                                });
                            });
                        </script>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-md-offset-2 col-md-8 terms-of-service">
                                <input id="termsofservice" type="checkbox" name="termsofservice" />
                                <label for="termsofservice">@T("Vendors.ApplyAccount.AcceptTermsOfService")</label>
                                @if (Model.TermsOfServicePopup)
                                {
                                <span class="read" id="read-acceptterms">@T("Vendors.ApplyAccount.AcceptTermsOfService.Read")</span>
                                <script asp-location="Footer">
                                    $(function () {
                                        $('#read-acceptterms').on('click',
                                            function (e) {
                                                displayPopupContentFromUrl(
                                                    '@Url.RouteUrl("TopicPopup", new {SystemName = "VendorTermsOfService"})',
                                                    '@T("Vendors.ApplyAccount.AcceptTermsOfService")');
                                            }
                                        );
                                    });
                                </script>
                                }
                                else
                                {
                                    <a class="read" id="read-acceptterms" href="@Url.RouteTopicUrl("VendorTermsOfService")">@T("Vendors.ApplyAccount.AcceptTermsOfService.Read")</a>
                                }
                            </div>
                        </div>
                    }
                    <div class="form-group">
                        <div class="buttons col-sm-offset-2 col-md-offset-2 col-md-2">
                            <button type="submit" name="send-email" class="btn btn-primary apply-vendor-button">@T("Vendors.ApplyAccount.Button")</button>
                        </div>
                    </div>
                </div>
            </form>
        }
        @await Component.InvokeAsync(typeof(WidgetViewComponent), new { widgetZone = PublicWidgetZones.ApplyVendorBottom, additionalData = Model })
    </div>
</div>