<div class="modal fade" id="@nameof(TermsModal)" tabindex="-1">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            @if (Seller != null)
            {
                <div class="modal-header">
                    <h5 class="modal-title">@Seller.Name Terms & Conditions</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    @if (string.IsNullOrEmpty(Seller.TermsAndConditions))
                    {
                        <strong>Seller @Seller.Name did not define any terms and conditions yet</strong>
                    }
                    else
                    {
                        @content
                    }
                </div>
            }
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

@code {

    [Inject]
    public IJSRuntime JsRuntime { get; set; }

    public MUser Seller { get; set; }

    private MarkupString content => new(Seller.TermsAndConditions);

    public async Task ShowAsync(MUser seller)
    {
        Seller = seller;
        await JsRuntime.ShowModalAsync(nameof(TermsModal));
        StateHasChanged();
    }
}