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.

3.5 KB
Raw Blame
@model AffiliatedOrderListModel

@* the affiliate's orders: the criteria in a filter bar above the grid, which loads on Search;
   Search is an outline button because Save is the screen's primary action *@
<admin-filters id="affiliate-order-filters" submit-id="search-orders" expanded="true" secondary-submit="true">
    <div class="grand-range">
        <admin-field asp-for="StartDate"/>
        <admin-field asp-for="EndDate"/>
    </div>
    <admin-field asp-for="OrderStatusId" asp-items="Model.AvailableOrderStatuses"/>
    <admin-field asp-for="PaymentStatusId" asp-items="Model.AvailablePaymentStatuses"/>
    <admin-field asp-for="ShippingStatusId" asp-items="Model.AvailableShippingStatuses"/>
</admin-filters>
<admin-card flush>
    <admin-grid id="orders-grid"
                read-url="@Url.Action("AffiliatedOrderList", "Affiliate", new { area = Constants.AreaAdmin })"
                additional-data="additionalData"
                auto-bind="false">
        <grid-column field="OrderNumber" title="@Loc["Admin.Affiliates.Orders.Order"]" width="80">
            <cell-template>
                <a class="text-decoration-none" href="@Url.Action("Edit", "Order", new { area = Constants.AreaAdmin })/{{ Id }}">{{ OrderNumber }}</a>
            </cell-template>
        </grid-column>
        <grid-column field="OrderStatus" title="@Loc["Admin.Affiliates.Orders.OrderStatus"]">
            <cell-template>
                <a class="text-decoration-none" href="@Url.Action("Edit", "Order", new { area = Constants.AreaAdmin })/{{ Id }}">{{ OrderStatus }}</a>
            </cell-template>
        </grid-column>
        <grid-column field="PaymentStatus" title="@Loc["Admin.Affiliates.Orders.PaymentStatus"]">
            <cell-template>
                <a class="text-decoration-none" href="@Url.Action("Edit", "Order", new { area = Constants.AreaAdmin })/{{ Id }}">{{ PaymentStatus }}</a>
            </cell-template>
        </grid-column>
        <grid-column field="ShippingStatus" title="@Loc["Admin.Affiliates.Orders.ShippingStatus"]">
            <cell-template>
                <a class="text-decoration-none" href="@Url.Action("Edit", "Order", new { area = Constants.AreaAdmin })/{{ Id }}">{{ ShippingStatus }}</a>
            </cell-template>
        </grid-column>
        <grid-column field="OrderTotal" title="@Loc["Admin.Affiliates.Orders.OrderTotal"]"/>
        <grid-column field="CreatedOn" title="@Loc["Admin.Affiliates.Orders.CreatedOn"]" format="{0:G}"/>
    </admin-grid>
</admin-card>
<script>

    var selectedIds = [];
    var reportAggregates = "";

    $(document).ready(function () {

        //search button
        $('#search-orders').click(function () {
            //search
            var grid = GrandAdmin.grids.get('#orders-grid');
            grid.dataSource.page(1); //new search. Set page size to 1
            //grid.dataSource.read(); we already loaded the grid above using "page" function
            return false;
        });
    });

    function additionalData() {
        var data = {
            AffliateId: '@(Model.AffliateId)',
            StartDate: $('#@Html.IdFor(model => model.StartDate)').val(),
            EndDate: $('#@Html.IdFor(model => model.EndDate)').val(),
            OrderStatusId: $('#@Html.IdFor(model => model.OrderStatusId)').val(),
            PaymentStatusId: $('#@Html.IdFor(model => model.PaymentStatusId)').val(),
            ShippingStatusId: $('#@Html.IdFor(model => model.ShippingStatusId)').val()
        };
        addAntiForgeryToken(data);
        return data;
    }
</script>