@model ShipmentDetailsModel

@if (string.IsNullOrEmpty(Model.Error))
{
    var button = await Html.PartialAsync("~/Plugins/Shipping.EasyPost/Views/Shipment/_ShipmentButtons.cshtml");
    var card = await Html.PartialAsync("~/Plugins/Shipping.EasyPost/Views/Shipment/_ShipmentDetails.EasyPost.cshtml", Model);

    //we need to replace some specific symbols here
    var content = await card.RenderHtmlContentAsync();
    content = content.Replace("</script>", "<\\/script>");
    card = Html.Raw(content);

    <script asp-location="None">
        $(document).ready(function () {
            $('.fa-file-pdf').closest('.btn-info').before(`@button`);
            $('#TrackingNumber').closest('.card-default').after(`@card`);
        });
    </script>
}
else
{
    <nop-alert asp-alert-id="easypost-alert" asp-alert-message="@Model.Error" />
    <script>
        $(document).ready(function () {
            $("#easypost-alert").click();
        });
    </script>
}