@using System.Collections
@using NzbDrone.Web.Models
@using System.Web.Mvc.Html
@model ExistingSeriesModel
@{
    Layout = null;
}

@if (Model == null)
{
    <h2 style="color: tomato">
        Error searching TheTVDB, please try again later.
    </h2>
}

else if (!Model.ExistingSeries.Any())
{
    <h2 style="color: tomato">
        No series available. Try adding a new Root Folder.
    </h2>
}
else
{
    @Html.DropDownList(Guid.NewGuid().ToString(), Model.Quality, new { @class = "qualitySelector masterQualitySelector" })

    @Html.TextBox(Guid.NewGuid().ToString(), "", new { type="date", @class = "jQuery-datepicker start-date-master", placeholder = "Custom Start Date", title = "Only download episodes that aired after the specified date" })

    foreach (var series in Model.ExistingSeries)
    {
    <div class="existingSeries">
        <span class="seriesPathValue">
            <label>@series.Item1</label>
        </span>
        <div class="existingSeriesContainer">
            <input class="seriesLookup" type="text" style="width: 400px;" value="@series.Item2" placeholder="Series Title" />
            @Html.Hidden("seriesId", series.Item3, new { @class = "seriesId" })
            @Html.DropDownList(Guid.NewGuid().ToString(), Model.Quality, new { @class = "qualitySelector" })
            @Html.TextBox(Guid.NewGuid().ToString(), "", new { type="date", @class = "jQuery-datepicker start-date", placeholder = "Custom Start Date", title = "Only download episodes that aired after the specified date" })
            <button class="addExistingButton">
                Add</button>
        </div>
    </div>
    }
}
