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.

2.3 KB
Raw Blame
@model ProductDetailsModel
@if (Model.DisplayOutOfStockSubscription)
{
    @*Ids are per product: a grouped product renders this partial once per variant.*@
    var modalId = $"subscribe-modal-form-{Model.Id}";
    var contentId = $"modal-subscribe-{Model.Id}";
    var buttonId = $"out-of-stock-subscribe-{Model.Id}";

    <input type="button" id="@buttonId" class="btn btn-secondary btn-sm subscribe-button" style="display:none;" value="@Loc["OutOfStockSubscriptions.NotifyMeWhenAvailable"]"/>

    <script type="application/json" data-grand-vm="outOfStockSubscription">@Json.Serialize(new {
                                                                               productId = Model.Id,
                                                                               routes = new {
                                                                                   popup = Url.RouteUrl("OutOfStockSubscribePopup", new { productId = Model.Id }),
                                                                                   buttonText = Url.RouteUrl("OutOfStockSubscribeButton", new { productId = Model.Id, warehouseId = "" })
                                                                               },
                                                                               elements = new { buttonId, modalId, contentId },
                                                                               res = new { warning = Loc["common.warning"].ToString() }
                                                                           })</script>

    <div class="modal fade" id="@modalId" tabindex="-1" aria-labelledby="@(modalId)-label" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="@(modalId)-label">@Loc["OutOfStockSubscriptions.Title"]</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    <div id="@contentId" class="alert-info alert mb-0">
                        @Loc["OutOfStockSubscriptions.PleaseWait"]
                    </div>
                </div>
            </div>
        </div>
    </div>
}