LocalGovIMS_localgov-ims/src/Admin/Views/AccountHolder/_Search.cshtml
@model Admin.Models.AccountHolder.SearchCriteria

@using (Html.BeginForm(Model.IsAPaymentSearch ? "PaymentSearch" : "Search", "AccountHolder", FormMethod.Get))
{
    @Html.HiddenFor(x => x.IsAPaymentSearch)
    
    <div>

        <div class="row">

            <div class="col-12 col-sm-6 col-md-4 col-lg-3 col-xxl-2">
                @Html.LabelFor(m => m.AccountReference, new { @class = "form-label" })
                @Html.TextBoxFor(m => m.AccountReference, new { size = 50, placeholder = "Enter account reference", @class = "form-control" })
            </div>

            <div class="col-12 col-sm-6 col-md-4 col-lg-3 col-xxl-2 pt-2 pt-sm-0">
                @Html.LabelFor(m => m.Surname, new { @class = "form-label" })
                @Html.TextBoxFor(m => m.Surname, new { size = 30, placeholder = "Enter surname", @class = "form-control" })
            </div>

            <div class="col-12 col-sm-6 col-md-4 col-lg-3 col-xxl-2 pt-2 pt-md-0">
                @if (!Model.IsAPaymentSearch)
                {
                    @Html.LabelFor(m => m.FundCode, new { @class = "form-label" })
                    <select id="FundCode" name="FundCode">
                        <option value="">None</option>
                        @foreach (var item in Model.Funds.Items)
                        {
                            <option class="item" value="@item.Value" @(!Model.FundCode.IsNullOrEmpty() && Model.FundCode.Equals(item.Value) ? "selected" : String.Empty)>@item.Text</option>
                        }
                    </select>
                }
                else
                {
                    @Html.HiddenFor(x => x.FundCode, new { size = 4 })
                }
            </div>

            <div class="col-12 col-sm-6 col-md-4 col-lg-3 col-xxl-2 pt-2 pt-lg-0">
                @Html.LabelFor(m => m.PostCode, new { @class = "form-label" })
                @Html.TextBoxFor(m => m.PostCode, new { size = 8, placeholder = "Enter postcode", @class = "form-control" })
            </div>

            <div class="col-12 col-sm-6 col-md-4 col-lg-3 col-xxl-2 pt-2 pt-xxl-0">
                @Html.LabelFor(m => m.Address, new { @class = "form-label" })
                @Html.TextBoxFor(m => m.Address, new { size = 60, placeholder = "Enter address", @class = "form-control" })
            </div>

            <div class="col-12 col-sm-6 col-md-4 col-lg-3 col-xxl-2 pt-3 offset-lg-6 offset-xl-6 offset-xxl-0 align-self-end d-grid gap-2 d-md-flex justify-content-end">
                <button class="btn btn-primary search" tabindex="0" type="submit">Search</button>
                @{
                    var queryString = string.Empty;

                    if (Model.IsAPaymentSearch)
                    {
                        queryString = "?IsAPaymentSearch=True&FundCode=" + Model.FundCode;
                    }

                    <a href="@Url.Action(Model.IsAPaymentSearch ? "PaymentSearch" : "Search", "AccountHolder")@queryString" class="btn btn-secondary" id="reset">Reset search</a>
                }
            </div>

        </div>

    </div>
}