@using FoodsharingSiegen.Contracts.Enums
@inherits FsBase

@if (ShowNotNeeded)
{
    <div class="row">
        <div class="col">
            <Field>
                <Switch TValue="bool" @bind-Checked="Interaction.NotNeeded" Color="Color.Primary">Nicht benötigt</Switch>
            </Field>
        </div>
        <div class="col">
            <Field>
                <Switch TValue="bool" @bind-Checked="Interaction.Alert" Color="Color.Danger">Achtung!</Switch>
            </Field>
        </div>
    </div>
}

<div class="row">
    <div class="col">
        <Field>
            <FieldLabel>Wann?</FieldLabel>
            <DatePicker TValue="DateTime" @bind-Date="Interaction.Date" ElementId="aim-datepicker" Max="DateTime.UtcNow.AddDays(7)" DisplayFormat="dd.MM.yyyy"/>
        </Field>
    </div>
</div>

@if (!string.IsNullOrWhiteSpace(Info1Name))
{
    <Field>
        <FieldLabel>@Info1Name</FieldLabel>
        <TextEdit @bind-Text="Interaction.Info1"></TextEdit>
    </Field>
}

@if (!string.IsNullOrWhiteSpace(Info2Name))
{
    <Field>
        <FieldLabel>@Info2Name</FieldLabel>
        <TextEdit @bind-Text="Interaction.Info2"></TextEdit>
    </Field>
}

@if (AllowFeedback)
{
    <div class="row">
        <div class="col-sm">
            <Field>
                <FieldLabel>Feedback</FieldLabel>
                <br/>
                <Buttons>
                    <Button Color="Color.Danger" Outline="@(Interaction.Feedback != InteractionFeedback.Negative)" Clicked="@(() => SetFeedbackAsync(InteractionFeedback.Negative))">
                        <i class="fa-solid fa-thumbs-down"></i>
                    </Button>
                    <Button Color="Color.Warning" Outline="@(Interaction.Feedback != InteractionFeedback.Neutral)" Clicked="@(() => SetFeedbackAsync(InteractionFeedback.Neutral))">
                        <i class="fa-solid fa-circle-dot"></i>
                    </Button>
                    <Button Color="Color.Success" Outline="@(Interaction.Feedback != InteractionFeedback.Positive)" Clicked="@(() => SetFeedbackAsync(InteractionFeedback.Positive))">
                        <i class="fa-solid fa-thumbs-up"></i>
                    </Button>
                </Buttons>
            </Field>
        </div>
        @if (Interaction.Feedback == InteractionFeedback.Negative)
        {
            <div class="col-sm">
                <Field>
                    <FieldLabel>Feedback Info</FieldLabel>
                    <TextEdit @bind-Text="Interaction.FeedbackInfo"></TextEdit>
                </Field>
            </div>
        }
    </div>
}

<div class="d-flex justify-content-end">
    <Button Color="Color.Secondary" Clicked="@ModalService.Hide">Abbrechen</Button>
    <Button Color="Color.Primary" Clicked="@AddInteractionAsync" Class="ml-2">OK</Button>
</div>
