Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

1.9 KB
Raw Blame
@model CustomerAttributeValueModel
@{
    Layout = "";
    //page title
    ViewBag.Title = Loc["Admin.Customers.CustomerAttributes.Values.AddNew"];
    var area = ViewContext.RouteData.Values["area"]?.ToString();
}
<form id="ValueCreatePopup" manifest="ValueCreatePopup" asp-area="@area" asp-controller="CustomerAttribute" asp-action="ValueCreatePopup"
      asp-route-customerAttributeId="@HtmlExtensions.HtmlEncodeSafe(Context.Request.Query["customerAttributeId"])"
      asp-route-btnId="@HtmlExtensions.HtmlEncodeSafe(Context.Request.Query["btnId"])"
      asp-route-formId="@HtmlExtensions.HtmlEncodeSafe(Context.Request.Query["formId"])">

    <admin-popup title="@Loc["Admin.Customers.CustomerAttributes.Values.AddNew"]" icon="bi-card-list">
        <partial name="Partials/CreateOrUpdateValue" model="Model"/>
    </admin-popup>
    <script>
        var mfp = $.magnificPopup.instance;
        $("#ValueCreatePopup").submit(function (e) {
            e.preventDefault();
            var form = $(this);
            var url = form.attr('action');
            $.ajax({
                type: "POST",
                url: url,
                data: form.serialize(),
                success: function (data) {
                    if (data == "") {
                        mfp.close();
                        $('#btnRefresh').click();
                    } else {
                        $.magnificPopup.open({
                            items: {
                                src: data,
                                type: 'inline'
                            },
                            callbacks: {
                                open: function () {
                                    $('.mfp-wrap').removeAttr('tabindex');
                                }
                            }
                        });
                    }
                }
            });
        });
    </script>
</form>