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.5 KB
Raw Blame
@using Widgets.Slider
@model ConfigurationModel

@inject SliderWidgetSettings setting

@* the widget settings post through the #savegeneralsettings script, not the page: the form wraps
   only this card, and its Save stays an outline button because Add new is the list's primary *@
<form method="post" id="widget-settings-form">
    @Html.AntiForgeryToken()
    <admin-card>
        <div class="grand-fields grand-fields--2col">
            <admin-field asp-for="DisplayOrder" size="sm"/>
            <admin-field asp-for="CustomerGroups"/>
            <admin-field asp-for="Stores"/>
        </div>
        <div class="grand-popup__actions">
            <button type="button" id="savegeneralsettings" class="btn btn-outline-secondary">
                <i class="bi bi-check-lg"></i> @Loc["Admin.Common.Save"]
            </button>
        </div>
    </admin-card>
        <script>
    $(function () {
        $('#savegeneralsettings').click(function () {

            var postData = $(this.form).serialize();

            $.ajax({
                cache: false,
                type: 'POST',
                url: '@Url.Action("Configure", "WidgetsSlider")',
                data: postData,
                dataType: 'json',
                success: function (data) {
                    alert('Saved');
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    alert('Failed to add record.');
                }
            });
            return false;
        });
    });
        </script>
</form>