@inject IConfigHelper config
@inject ITranslationHelper translator
@{
    var userConfig = config.GetUserConfig(User);
    var userLanguage = userConfig.UserLanguage;
}
@using CarCareTracker.Helper
@model List<ReminderRecordViewModel>
@if (Model.Count() > 1)
{
    <div class="mb-2">
        <input class="form-check-input" type="checkbox" onchange="showMultipleRemindersSelector()" id="multipleRemindersCheck">
        <label class="form-check-label" for="multipleRemindersCheck">@translator.Translate(userLanguage, "Multiple")</label>
    </div>
}
<select class="form-select" id="recurringReminderInput">
    @if (Model.Any())
    {
        @foreach (ReminderRecordViewModel reminderRecord in Model)
        {
            @switch(reminderRecord.UserMetric){
                case (ReminderMetric.Both):
                    <!option value="@reminderRecord.Id" data-description="@reminderRecord.Description" class="@StaticHelper.GetReminderUrgencyColor(reminderRecord.Urgency)">
                        @($"{reminderRecord.Description} | {reminderRecord.Date.ToShortDateString()} | {reminderRecord.Mileage}")
                    </!option>
                    break;
                case (ReminderMetric.Odometer):
                    <!option value="@reminderRecord.Id" data-description="@reminderRecord.Description" class="@StaticHelper.GetReminderUrgencyColor(reminderRecord.Urgency)">
                        @($"{reminderRecord.Description} | {reminderRecord.Mileage}")
                    </!option>
                    break;
                case (ReminderMetric.Date):
                    <!option value="@reminderRecord.Id" data-description="@reminderRecord.Description" class="@StaticHelper.GetReminderUrgencyColor(reminderRecord.Urgency)">
                        @($"{reminderRecord.Description} | {reminderRecord.Date.ToShortDateString()}")
                    </!option>
                    break;
            }
        }
    } else
    {
        <!option value="0">@translator.Translate(userLanguage, "No Recurring Reminders Found")</!option>
    }
</select>
<div id="recurringMultipleReminders" style="display:none;">
    <ul class="list-group">
        @foreach (ReminderRecordViewModel reminderRecord in Model)
        {
            <li class="list-group-item text-start">
                <input class="form-check-input" type="checkbox" value="@reminderRecord.Id" data-description="@reminderRecord.Description" id="recurringReminder_@reminderRecord.Id">
                <label class="form-check-label stretched-link" for="recurringReminder_@reminderRecord.Id">
                    @reminderRecord.Description
                    <br /><small class="badge @StaticHelper.GetReminderUrgencyColor(reminderRecord.Urgency)">
                    @switch (reminderRecord.UserMetric){
                        case (ReminderMetric.Both):
                            <i class='bi bi-calendar-event me-2'></i>@reminderRecord.Date.ToShortDateString()<i class='bi bi-speedometer ms-2 me-2'></i>@reminderRecord.Mileage
                        break;
                        case (ReminderMetric.Odometer):
                            <i class='bi bi-speedometer me-2'></i>@reminderRecord.Mileage
                        break;
                        case (ReminderMetric.Date):
                            <i class='bi bi-calendar-event me-2'></i>@reminderRecord.Date.ToShortDateString()
                        break;
                    }
                </small>
                </label>
            </li>
        }
    </ul>
</div>