@{
    ViewData["Title"] = "Admin Settings";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

@model EForT.Models.SettingsModel

<div class="app-content container center-layout py-3">
    <div class="content-header row">
        <div class="content-header-left col-12 mb-2">
            <h1 class="content-header-title mb-0">Admin Settings</h1>
            <div class="row breadcrumbs-top">
                <div class="breadcrumb-wrapper col-12">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item">
                          <a href="@Url.Action("AdminAccount", "UserManagement")">Administrator Home</a>
                        </li>
                        <li class="breadcrumb-item active">
                            Settings
                        </li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
    <div class="content-wrapper">
        <div class="content-body">
            <div class="row">
                <div class="col-12 col-sm-12 col-md-8 col-lg-6 col-xl-6">
                    <div class="card">
                        <div class="card-header pb-0">
                            <div class="font-medium-2 bottom-border">
                                <p>Account Details</p>
                            </div>
                        </div>
                        <div class="card-content">
                            <div class="card-body">
                                <form id="editSettingsForm" asp-action="EditSettings" asp-controller="AdminSettings" method="post">
                                    <input type="hidden" asp-for="AdminSettings.Id" id="hdnAdminSettingsID" />
                                    <div class="modal-body">
                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="ExpertAdvisor">ExpertAdvisor: <i class="warning">*</i></label>
                                            <select class="form-control" asp-for="AdminSettings.ExpertAdvisorId" id="ExpertAdvisorID" required>
                                                <option value="@Model.AdminSettings.ExpertAdvisorId" selected disabled>Select</option>
                                                @if (Model.ListOfAdvisors != null)
                                                {
                                                    if (Model.ListOfAdvisors.ToList().Count > 0)
                                                    {
                                                        for (int i = 0; i < Model.ListOfAdvisors.ToList().Count; i++)
                                                        {
                                                            <option value="@Model.ListOfAdvisors.ToArray()[i].Id">@Model.ListOfAdvisors.ToArray()[i].Name</option>
                                                        }
                                                    }
                                                }
                                            </select>
                                        </fieldset>

                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="Publisher">Publisher: <i class="warning">*</i></label>
                                            <select class="form-control" asp-for="AdminSettings.PublisherId" id="PublisherID" required>
                                                <option value="@Model.AdminSettings.PublisherId" selected disabled>Select</option>
                                                @if (Model.ListOfAdvisors != null)
                                                {
                                                    if (Model.ListOfAdvisors.ToList().Count > 0)
                                                    {
                                                        for (int i = 0; i < Model.ListOfAdvisors.ToList().Count; i++)
                                                        {
                                                            <option value="@Model.ListOfAdvisors.ToArray()[i].Id">@Model.ListOfAdvisors.ToArray()[i].Name</option>
                                                        }
                                                    }
                                                }
                                            </select>
                                        </fieldset>

                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="Subscriber">Subscriber: <i class="warning">*</i></label>
                                            <select class="form-control" asp-for="AdminSettings.SubscriberId" id="SubscriberID" required>
                                                <option value="@Model.AdminSettings.SubscriberId" selected disabled>Select</option>
                                                @if (Model.ListOfAdvisors != null)
                                                {
                                                    if (Model.ListOfAdvisors.ToList().Count > 0)
                                                    {
                                                        for (int i = 0; i < Model.ListOfAdvisors.ToList().Count; i++)
                                                        {
                                                            <option value="@Model.ListOfAdvisors.ToArray()[i].Id">@Model.ListOfAdvisors.ToArray()[i].Name</option>
                                                        }
                                                    }
                                                }
                                            </select>
                                        </fieldset>

                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="Subscriber">Validator Script: <i class="warning">*</i></label>
                                            <select class="form-control" asp-for="AdminSettings.ValidatorScriptId" id="ValidatorScriptID" required>
                                                <option value="@Model.AdminSettings.ValidatorScriptId" selected disabled>Select</option>
                                                @if (Model.ListOfScripts != null)
                                                {
                                                    if (Model.ListOfScripts.ToList().Count > 0)
                                                    {
                                                        for (int i = 0; i < Model.ListOfScripts.ToList().Count; i++)
                                                        {
                                                            <option value="@Model.ListOfScripts.ToArray()[i].Id">@Model.ListOfScripts.ToArray()[i].ScriptName</option>
                                                        }
                                                    }
                                                }
                                            </select>
                                        </fieldset>

                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="Subscriber">Starter Script: <i class="warning">*</i></label>
                                            <select class="form-control" asp-for="AdminSettings.StarterScriptId" id="StarterScriptID" required>
                                                <option value="@Model.AdminSettings.StarterScriptId" selected disabled>Select</option>
                                                @if (Model.ListOfScripts != null)
                                                {
                                                    if (Model.ListOfScripts.ToList().Count > 0)
                                                    {
                                                        for (int i = 0; i < Model.ListOfScripts.ToList().Count; i++)
                                                        {
                                                            <option value="@Model.ListOfScripts.ToArray()[i].Id">@Model.ListOfScripts.ToArray()[i].ScriptName</option>
                                                        }
                                                    }
                                                }
                                            </select>
                                        </fieldset>

                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="ThumbnailFile">Refresh Rate: <i class="warning">*</i></label>
                                            <input type="number" min="0" class="form-control" asp-for="AdminSettings.RefreshRate" id="ThumbnailFileID" value="@Model.AdminSettings.RefreshRate" required />
                                        </fieldset>

                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="SessionNumberID">Default VPS Desktop Session Number: <i class="warning">*</i></label>
                                            <input type="number"  class="form-control" asp-for="AdminSettings.DefaultDesktopSessionNumber" id="SessionNumberID" value="@Model.AdminSettings.DefaultDesktopSessionNumber" required />
                                        </fieldset>

                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="ThumbnailFile">Thumbnail File: <i class="warning">*</i></label>
                                            <input type="text" class="form-control" asp-for="AdminSettings.ThumbnailFile" id="ThumbnailFileID" value="@Model.AdminSettings.ThumbnailFile" required />
                                        </fieldset>

                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="ReportFile">Report File: <i class="warning">*</i></label>
                                            <input type="text" class="form-control" asp-for="AdminSettings.ReportFile" id="ReportFileID" value="@Model.AdminSettings.ReportFile" required />
                                        </fieldset>

                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="FTPLink">Shared Base Url: <i class="warning">*</i></label>
                                            <input type="url" class="form-control" asp-for="AdminSettings.SharedBaseUrl" id="FTPServerBaseUrlID" value="@Model.AdminSettings.SharedBaseUrl" required />
                                        </fieldset>

                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="FTPRootDir">Shared Folder Directory: <i class="warning">*</i></label>
                                            <input type="text" class="form-control" asp-for="AdminSettings.SharedFolderDirectory" id="FTPServerBaseDirID" value="@Model.AdminSettings.SharedFolderDirectory" required />
                                        </fieldset>

                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="FTPUsername">VPS Username: <i class="warning">*</i></label>
                                            <input type="text" class="form-control" asp-for="AdminSettings.VPSUsername" id="FTPUsernameID" value="@Model.AdminSettings.VPSUsername" required />
                                        </fieldset>

                                        <fieldset class="form-group floating-label-form-group">
                                            <label for="FTPPassword">VPS Password: <i class="warning">*</i></label>
                                            <input type="text" class="form-control" asp-for="AdminSettings.VPSPassword" id="FTPLinkID" value="@Model.AdminSettings.VPSPassword" required />
                                        </fieldset>


                                    </div>
                                    <div class="modal-footer">
                                        <input id="btn-edit-settings" type="submit" class="btn btn-primary" value="Save Changes">
                                        <input type="reset" class="btn btn-secondary" onclick="location.href='@Url.Action("ResetSettings")'" value="Reset To Default">
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>