@using Website.Components.MarkdownEditor

<div class="mb-3">
    <h4>Seller Settings</h4>
</div>
<EditForm OnValidSubmit="SubmitAsync" Model="User">

    <div class="card mb-3">
        <div class="card-header d-flex align-items-center">
            <div class="form-check form-switch">
                <InputCheckbox class="form-check-input cursor-pointer" @bind-Value="User.IsPayPalEnabled" id="IsPayPalEnabled" />
                <label class="form-check-label" for="IsPayPalEnabled">PayPal payments</label>
            </div>
        </div>

        @if (User.IsPayPalEnabled)
        {
            <div class="card-body">
                <div class="mb-3">
                    <label class="form-label">PayPal Address</label>
                    <InputText class="form-control" @bind-Value="User.PayPalAddress" />
                    <div class="form-text">Your PayPal address to receive payments</div>
                </div>
            </div>
        }
    </div>

    <div class="card mb-3">
        <div class="card-header d-flex align-items-center">
            <div class="form-check form-switch">
                <InputCheckbox class="form-check-input cursor-pointer" @bind-Value="User.IsStripeEnabled" id="IsStripeEnabled" />
                <label class="form-check-label cursor-pointer" for="IsStripeEnabled">Stripe payments</label>
            </div>
        </div>

        <div class="alert alert-info m-2">
            Before you enable Stripe payments, contact UnturnedStore administrators to register your Stripe account ID on the platform.
        </div>

        @if (User.IsStripeEnabled)
        {
            <div class="card-body">
                <div class="mb-3">
                    <label class="form-label">Stripe Account ID</label>
                    <InputText class="form-control" @bind-Value="User.StripeAccountId" />
                    <div class="form-text">Your Stripe account ID to receive payments</div>
                </div>
            </div>
        }
    </div>

    <div class="mb-3">
        <label class="form-label">Terms & Conditions</label>
        <MarkdownEditor @bind-Value="User.TermsAndConditions" EnableToolbar="false" DisableHtml="false" HighlightedPlaceholders="@(new string[] { "PluginName" })" />
        <div class="form-text">Terms & Conditions of purchasing your products</div>
    </div>

    <ValidationSummary />
    <DataAnnotationsValidator />

    @if (IsLoading)
    {
        <LoadingButton />
    }
    else
    {
        <button type="submit" class="btn btn-primary">Update Seller</button>
    }
</EditForm>