@inherits FsBase

@{
    var divClass = $"{CssClass} pc-main";
    if (Prospect is { Complete: true }) divClass += " complete";
}

<div class="@divClass">
    <h5 class="mb-0">
        @if (ProspectModal != null && CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.Ambassador))
        {
            <a href=""><i class="fa-solid fa-pen-to-square" @onclick="() => ProspectModal.Show(Prospect)" @onclick:preventDefault></i> </a>
        }

        @Prospect?.Name
        <small style="font-size: .9rem; opacity: .7;">
            <a class="invert" href="@(CurrentUser.NetworkLink)/profile/@Prospect?.FsId" target="_blank">Profil öffnen</a>
        </small>
    </h5>

    @if (!string.IsNullOrWhiteSpace(Prospect?.Memo) || Prospect?.Warning is true)
    {
        var alertColor = Prospect?.Warning is true ? Color.Warning : Color.Info;
        var alertIconClass = Prospect?.Warning is true ? "fa-solid fa-triangle-exclamation" : "fa-solid fa-circle-info";

        <Alert Color="alertColor" Visible Class="p-2 mb-1">
            <AlertDescription><i class="@alertIconClass"></i> @Prospect?.Memo</AlertDescription>
        </Alert>
    }


    <table style="width: 100%;">

        <InteractionRow
            Prospect="Prospect"
            Type="InteractionType.Welcome"
            AllowInteraction="@(StateFilter == ProspectStateFilter.OnBoarding && CurrentUser.IsInGroup(UserGroup.WelcomeTeam))"
            AddClick="() => AddInteraction(InteractionType.Welcome)"
            RemoveClick="@RemoveInteraction"
            Caption="Begrüßung"
            ButtonIconClass="fa-solid fa-check"
            IconClass="fa-solid fa-handshake-simple">
        </InteractionRow>

        <InteractionRow
            Prospect="Prospect"
            Type="InteractionType.StepInBriefing"
            AllowInteraction="@(StateFilter == ProspectStateFilter.OnBoarding && CurrentUser.IsInGroup(UserGroup.WelcomeTeam))"
            AddClick="() => AddInteraction(InteractionType.StepInBriefing)"
            RemoveClick="@RemoveInteraction"
            Caption="@AppSettings.StepInName"
            ButtonIconClass="fa-solid fa-check"
            IconClass="fa-solid fa-graduation-cap">
        </InteractionRow>

        <InteractionRow
            Prospect="Prospect"
            Type="InteractionType.EinAb"
            AllowInteraction="@(StateFilter == ProspectStateFilter.OnBoarding && CurrentUser.IsInGroup(UserGroup.WelcomeTeam, UserGroup.StoreManager, UserGroup.Ambassador))"
            AddClick="() => AddInteraction(InteractionType.EinAb)"
            RemoveClick="@RemoveInteraction"
            Caption="Einführungen"
            Multiple="true"
            Minimum="3"
            ButtonIconClass="fa-solid fa-plus"
            IconClass="fa-solid fa-basket-shopping">
        </InteractionRow>

        <tr>
            <td colspan="3">
                <hr style="margin: 10px 0;">
            </td>
        </tr>

        <InteractionRow
            Prospect="Prospect"
            Type="InteractionType.ReleasedForVerification"
            AllowInteraction="@(StateFilter == ProspectStateFilter.OnBoarding && CurrentUser.IsInGroup(UserGroup.WelcomeTeam))"
            AddClick="() => AddInteraction(InteractionType.ReleasedForVerification)"
            RemoveClick="@RemoveInteraction"
            Caption="Freigabe zur Verifizierung"
            ButtonIconClass="fa-solid fa-check"
            IconClass="fa-solid fa-id-card">
        </InteractionRow>

        @if (CurrentUser.IsInGroup(UserGroup.Ambassador))
        {
            <InteractionRow
                Prospect="Prospect"
                Type="InteractionType.IdCheck"
                AllowInteraction="@CurrentUser.IsInGroup(UserGroup.Ambassador)"
                AddClick="() => AddInteraction(InteractionType.IdCheck)"
                RemoveClick="@RemoveInteraction"
                Caption="Perso checken"
                ButtonIconClass="fa-solid fa-check"
                IconClass="fa-solid fa-magnifying-glass">
            </InteractionRow>
        }

        @if (StateFilter > ProspectStateFilter.OnBoarding)
        {
            <InteractionRow
                Prospect="Prospect"
                Type="InteractionType.PrintPass"
                AllowInteraction="@CurrentUser.IsInGroup(UserGroup.Ambassador)"
                AddClick="() => AddInteraction(InteractionType.PrintPass)"
                RemoveClick="@RemoveInteraction"
                Caption="FS-Ausweis (print)"
                ButtonIconClass="fa-solid fa-check"
                IconClass="fa-solid fa-id-card">
            </InteractionRow>

            <InteractionRow
                Prospect="Prospect"
                AllowInteraction="@CurrentUser.IsInGroup(UserGroup.Ambassador)"
                Type="InteractionType.Verify"
                AddClick="() => AddInteraction(InteractionType.Verify)"
                RemoveClick="@RemoveInteraction"
                Caption="Verifizieren"
                ButtonIconClass="fa-solid fa-check"
                IconClass="fa-solid fa-user-check">
            </InteractionRow>

            <tr>
                <td colspan="3">
                    <hr style="margin: 10px 0;">
                </td>
            </tr>

            <InteractionRow
                Prospect="Prospect"
                AllowInteraction="@CurrentUser.IsInGroup(UserGroup.Ambassador)"
                Type="InteractionType.Complete"
                AddClick="() => AddInteraction(InteractionType.Complete)"
                RemoveClick="@RemoveInteraction"
                Caption="Fertig"
                ButtonIconClass="fa-solid fa-check"
                IconClass="fa-solid fa-flag-checkered">
            </InteractionRow>
        }

    </table>


</div>