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.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
@model ShipmentListModel
@{
ViewBag.Title = Loc["Admin.Orders.Shipments.List"];
var area = ViewContext.RouteData.Values["area"]?.ToString();
}
<form asp-area="@area" asp-controller="Shipment" asp-action="List" method="post">
@* The product list's shape: packaging slips in the overflow menu, the tracking number as the
quick search, and ship / deliver / print for the ticked rows in the bulk bar. There is no
Add new - a shipment is added from its order - so Search is the one primary action. *@
<admin-page title="@Loc["Admin.Orders.Shipments.List"]" icon="bi-truck">
<page-actions>
<admin-action-menu>
<admin-action submit="true" name="exportpackagingslips-all"
url="@Url.Action("PdfPackagingSlipAll", new { area = area })"
icon="bi-file-earmark-pdf" text="@Loc["Admin.Orders.Shipments.PrintPackagingSlip.All"]"/>
</admin-action-menu>
<partial name="Partials/WidgetZone.ListButtons" model="Model"/>
</page-actions>
<admin-filters id="shipment-filters" submit-id="search-shipments">
<filters-search>
<admin-input asp-for="TrackingNumber"/>
</filters-search>
<admin-field asp-for="StartDate"/>
<admin-field asp-for="EndDate"/>
<admin-field asp-for="LoadNotShipped"/>
</admin-filters>
<admin-card flush>
<admin-bulkbar grid-id="shipments-grid">
<button class="btn btn-outline-secondary btn-sm" type="submit" id="ship-selected">
<i class="bi bi-check-lg"></i> @Loc["Admin.Orders.Shipments.ShipSelected"]
</button>
<button class="btn btn-outline-secondary btn-sm" type="submit" id="deliver-selected">
<i class="bi bi-check-circle"></i> @Loc["Admin.Orders.Shipments.DeliverySelected"]
</button>
<button type="submit" id="exportpackagingslips-selected" class="btn btn-outline-secondary btn-sm">
<i class="bi bi-file-earmark-pdf"></i> @Loc["Admin.Orders.Shipments.PrintPackagingSlip.Selected"]
</button>
</admin-bulkbar>
<admin-grid id="shipments-grid"
read-url="@Url.Action("ShipmentListSelect", "Shipment", new { area = area })"
additional-data="additionalData"
selectable="Checkbox"
on-change="onShipmentSelectionChange">
<grid-column field="ShipmentNumber" title="@Loc["Admin.Orders.Shipments.ID"]" width="100">
<cell-template>
<a class="text-decoration-none" href="@Url.Action("ShipmentDetails", "Shipment", new { area = area })/{{ Id }}">{{ ShipmentNumber }}</a>
</cell-template>
</grid-column>
<grid-column field="OrderNumber" title="@Loc["Admin.Orders.Shipments.OrderID"]" width="100">
<cell-template>
<a class="text-decoration-none" href="@Url.Action("Edit", "Order", new { area = area })/{{ OrderId }}">{{ OrderNumber }}</a>
</cell-template>
</grid-column>
<grid-column field="TrackingNumber" title="@Loc["Admin.Orders.Shipments.TrackingNumber"]" width="100">
<cell-template>
<a class="text-decoration-none" href="@Url.Action("ShipmentDetails", "Shipment", new { area = area })/{{ Id }}">{{ TrackingNumber }}</a>
</cell-template>
</grid-column>
<grid-column field="TotalWeight" title="@Loc["Admin.Orders.Shipments.TotalWeight"]" width="80" min-screen-width="770"/>
<grid-column field="ShippedDate" title="@Loc["Admin.Orders.Shipments.ShippedDate"]" width="180" format="{0:G}"/>
<grid-column field="DeliveryDate" title="@Loc["Admin.Orders.Shipments.DeliveryDate"]" width="180" format="{0:G}"/>
<grid-detail read-url="@Url.Action("ShipmentsItemsByShipmentId", "Shipment", new { area = area })" param="shipmentId:Id">
<grid-column field="ProductName" title="@Loc["Admin.Orders.Shipments.Products.ProductName"]" width="400"/>
<grid-column field="ShippedFromWarehouse" title="@Loc["Admin.Orders.Shipments.Products.Warehouse"]" width="150"/>
<grid-column field="QuantityInThisShipment" title="@Loc["Admin.Orders.Shipments.Products.QtyShipped"]" width="150"/>
<grid-column field="ItemWeight" title="@Loc["Admin.Orders.Shipments.Products.ItemWeight"]" width="150"/>
<grid-column field="ItemDimensions" title="@Loc["Admin.Orders.Shipments.Products.ItemDimensions"]" width="150"/>
</grid-detail>
</admin-grid>
</admin-card>
</admin-page>
<script>
var selectedIds = [];
$(document).ready(function () {
$("#@Html.IdFor(model => model.CountryId)").change(function () {
var selectedItem = $(this).val();
var ddlStates = $("#@Html.IdFor(model => model.StateProvinceId)");
$.ajax({
cache: false,
type: "GET",
url: "@(Url.Action("GetStatesByCountryId", "Home", new { area = area }))",
data: { "countryId": selectedItem, "addAsterisk": "true" },
success: function (data) {
ddlStates.html('');
$.each(data, function (id, option) {
ddlStates.append($('<option></option>').val(option.id).html(option.name));
});
},
error: function (xhr, ajaxOptions, thrownError) {
alert('Failed to retrieve states.');
}
});
});
$("#@Html.IdFor(model => model.TrackingNumber)").keydown(function (event) {
if (event.keyCode == 13) {
$("#search-shipments").click();
return false;
}
});
$("#@Html.IdFor(model => model.City)").keydown(function (event) {
if (event.keyCode == 13) {
$("#search-shipments").click();
return false;
}
});
$('#search-shipments').click(function () {
var grid = GrandAdmin.grids.get('#shipments-grid');
grid.dataSource.page(1);
grid.clearSelection();
return false;
});
$('#ship-selected').click(function(e) {
e.preventDefault();
var postData = {
selectedIds: selectedIds
};
addAntiForgeryToken(postData);
$.ajax({
cache: false,
type: "POST",
url: "@(Url.Action("SetAsShippedSelected", "Shipment", new { area = area }))",
data: postData,
complete: function(data) {
var grid = GrandAdmin.grids.get('#shipments-grid');
grid.dataSource.read();
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError);
},
traditional: true
});
return false;
});
$('#deliver-selected').click(function(e) {
e.preventDefault();
var postData = {
selectedIds: selectedIds
};
addAntiForgeryToken(postData);
$.ajax({
cache: false,
type: "POST",
url: "@(Url.Action("SetAsDeliveredSelected", "Shipment", new { area = area }))",
data: postData,
complete: function(data) {
var grid = GrandAdmin.grids.get('#shipments-grid');
grid.dataSource.read();
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError);
},
traditional: true
});
return false;
});
});
function additionalData() {
var data = {
StartDate: $('#@Html.IdFor(model => model.StartDate)').val(),
EndDate: $('#@Html.IdFor(model => model.EndDate)').val(),
TrackingNumber: $('#@Html.IdFor(model => model.TrackingNumber)').val(),
CountryId: $('#@Html.IdFor(model => model.CountryId)').val(),
StateProvinceId: $('#@Html.IdFor(model => model.StateProvinceId)').val(),
City: $('#@Html.IdFor(model => model.City)').val(),
WarehouseId: $('#@Html.IdFor(model => model.WarehouseId)').val(),
LoadNotShipped: $('#@Html.IdFor(model => model.LoadNotShipped)').is(':checked')
};
addAntiForgeryToken(data);
return data;
}
function onShipmentSelectionChange(e) {
selectedIds = e.selectedIds;
}
</script>
</form>
<form asp-area="@area" asp-controller="Shipment" asp-action="PdfPackagingSlipSelected" method="post" id="pdf-packaging-slip-selected-form">
<input type="hidden" id="selectedIds" name="selectedIds" value=""/>
</form>
<script>
$(document).ready(function () {
$('#exportpackagingslips-selected').click(function (e) {
e.preventDefault();
var ids = selectedIds.join(",");
$('#pdf-packaging-slip-selected-form #selectedIds').val(ids);
$('#pdf-packaging-slip-selected-form').submit();
return false;
});
});
</script>