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.

6.4 KB
Raw Blame
@model ShipmentModel
@{
    var area = ViewContext.RouteData.Values["area"]?.ToString();
    var isShipped = Model.ShippedDateUtc.HasValue;
    var isDelivered = Model.DeliveryDateUtc.HasValue;
}
@* The summary reads the shipment at a glance as facts and chips; everything editable sits in
   the card below it. *@
<admin-card>
    <div class="grand-facts">
        <div>
            <div class="grand-fact__label">@Loc["Admin.Orders.Shipments.ID"]</div>
            <div class="grand-fact__value">@Model.ShipmentNumber</div>
        </div>
        <div>
            <div class="grand-fact__label">@Loc["Admin.Orders.Shipments.OrderID"]</div>
            <div class="grand-fact__value">
                <a href="@Url.Action("Edit", "Order", new { Id = Model.OrderId, area = area })">@Model.OrderNumber</a>
            </div>
        </div>
        <div>
            <div class="grand-fact__label">@Loc["Admin.Orders.Shipments.TotalWeight"]</div>
            <div class="grand-fact__value">@Model.TotalWeight</div>
        </div>
        <div>
            <div class="grand-fact__label">@Loc["Admin.Orders.Shipments.Products"]</div>
            <div class="grand-fact__value">@Model.Items.Count</div>
        </div>
    </div>
    <div class="d-flex flex-wrap gap-2 mt-3">
        <span class="grand-chip @(isShipped ? "grand-chip--green" : "")">
            <i class="bi bi-truck"></i>
            @Loc["Admin.Orders.Shipments.ShippedDate"]:
            @if (isShipped)
            {
                @Model.ShippedDate.Value.ToString("g")
            }
            else
            {
                @Loc["Admin.Orders.Shipments.ShippedDate.NotYet"]
            }
        </span>
        <span class="grand-chip @(isDelivered ? "grand-chip--green" : "")">
            <i class="bi bi-box-seam"></i>
            @Loc["Admin.Orders.Shipments.DeliveryDate"]:
            @if (isDelivered)
            {
                @Model.DeliveryDate.Value.ToString("g")
            }
            else
            {
                @Loc["Admin.Orders.Shipments.DeliveryDate.NotYet"]
            }
        </span>
        @if (!string.IsNullOrEmpty(Model.TrackingNumber))
        {
            <span class="grand-chip">
                <i class="bi bi-upc-scan"></i>
                @Loc["Admin.Orders.Shipments.TrackingNumber"]: @Model.TrackingNumber
            </span>
        }
    </div>
</admin-card>

@* One form, one Save: tracking number, admin comment and both dates post together to
   SaveShipmentInfo, the screen's one primary action. Shipping and delivering stay in the page
   header, because they notify the customer. *@
<admin-card title="@Loc["Admin.Orders.Shipments.ViewDetails.Info"]">
    <card-actions>
        <input type="submit" name="saveshipmentinfo" asp-action="SaveShipmentInfo" value="@Loc["Admin.Common.Save"]" class="btn btn-primary btn-sm"/>
    </card-actions>
    <div class="grand-fields grand-fields--2col">
        <admin-field asp-for="TrackingNumber">
            <admin-input asp-for="TrackingNumber"/>
            @if (!string.IsNullOrEmpty(Model.TrackingNumberUrl))
            {
                <a href="@Model.TrackingNumberUrl" target="_blank" class="tracking-url form-text">
                    <i class="bi bi-box-arrow-up-right"></i> @Loc["Admin.Orders.Shipments.TrackingNumber.ViewOnline"]
                </a>
            }
        </admin-field>
        <admin-field asp-for="ShippedDate"
                     hint="@(isShipped ? Loc["Admin.Orders.Shipments.ShippedDate.Enter"].Value : Loc["Admin.Orders.Shipments.ShippedDate.Enter"].Value + " " + Loc["Admin.Orders.Shipments.ShippedDate.Hint"].Value)"/>
        <admin-field asp-for="AdminComment">
            <admin-textarea asp-for="AdminComment"/>
        </admin-field>
        <admin-field asp-for="DeliveryDate"
                     hint="@(isDelivered ? Loc["Admin.Orders.Shipments.DeliveryDate.Enter"].Value : Loc["Admin.Orders.Shipments.DeliveryDate.Enter"].Value + " " + Loc["Admin.Orders.Shipments.DeliveryDate.Hint"].Value)"/>
    </div>
</admin-card>

<admin-card title="@Loc["Admin.Orders.Shipments.Products"]" flush>
    @* the items travel with the page, as the table had them; all rows, no pager *@
    <admin-grid id="shipmentitems-grid"
                data="@Model.Items.Select(x => new { x.ProductId, x.ProductName, x.AttributeInfo, x.RentalInfo, x.Sku, x.ShippedFromWarehouse, x.ItemWeight, x.ItemDimensions, x.QuantityInThisShipment })"
                pager="None">
        <grid-column field="ProductName" title="@Loc["Admin.Orders.Shipments.Products.ProductName"]" width="350">
            <cell-template>
                <div>
                    <em><a href="@Url.Action("Edit", "Product", new { area = area })/{{ ProductId }}">{{ ProductName }}</a></em>
                    <p data-if="AttributeInfo">{{{ AttributeInfo }}}</p>
                    <p data-if="RentalInfo">{{{ RentalInfo }}}</p>
                </div>
            </cell-template>
        </grid-column>
        <grid-column field="Sku" title="@Loc["Admin.Orders.Shipments.Products.SKU"]" width="150"/>
        <grid-column field="ShippedFromWarehouse" title="@Loc["Admin.Orders.Shipments.Products.Warehouse"]" width="150"/>
        <grid-column field="ItemWeight" title="@Loc["Admin.Orders.Shipments.Products.ItemWeight"]" width="100"/>
        <grid-column field="ItemDimensions" title="@Loc["Admin.Orders.Shipments.Products.ItemDimensions"]" width="150"/>
        <grid-column field="QuantityInThisShipment" title="@Loc["Admin.Orders.Shipments.Products.QtyShipped"]" width="100"/>
    </admin-grid>
</admin-card>

@if (Model.ShipmentStatusEvents.Count > 0)
{
    <admin-card title="@Loc["Admin.Orders.Shipments.ShipmentStatusEvents"]" flush>
        @* the carrier's events travel with the page too; all rows, no pager *@
        <admin-grid id="shipmentevents-grid"
                    data="@Model.ShipmentStatusEvents.Select(x => new { x.EventName, x.Location, x.Country, x.Date })"
                    pager="None">
            <grid-column field="EventName" title="@Loc["Admin.Orders.Shipments.ShipmentStatusEvents.Event"]" width="400"/>
            <grid-column field="Location" title="@Loc["Admin.Orders.Shipments.ShipmentStatusEvents.Location"]" width="200"/>
            <grid-column field="Country" title="@Loc["Admin.Orders.Shipments.ShipmentStatusEvents.Country"]" width="200"/>
            <grid-column field="Date" title="@Loc["Admin.Orders.Shipments.ShipmentStatusEvents.Date"]" width="200" format="{0:d}"/>
        </admin-grid>
    </admin-card>
}