@page
@model RegisterModel
@{
    ViewData["Title"] = "Register";
}

<script src="https://kit.fontawesome.com/63288dd016.js" crossorigin="anonymous"></script>

<h1>@ViewData["Title"]</h1>

<div class="row">
    <div class="col-md-4">
        <form asp-route-returnUrl="@Model.ReturnUrl" method="post">
            <h4>Create a new account.</h4>
            <hr />
            <div asp-validation-summary="All" class="text-danger"></div>

            <div class="form-group">
                <label asp-for="Input.Name"></label>
                <input asp-for="Input.Name" class="form-control" />
                <span asp-validation-for="Input.Name" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Input.DOB"></label>
                <input asp-for="Input.DOB" class="form-control" />
                <span asp-validation-for="Input.DOB" class="text-danger"></span>
            </div>

            <div class="form-group">
                <label asp-for="Input.Email"></label>
                <input asp-for="Input.Email" class="form-control" />
                <span asp-validation-for="Input.Email" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Input.Password"></label>
                <input asp-for="Input.Password" class="form-control" />
                <span asp-validation-for="Input.Password" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Input.ConfirmPassword"></label>
                <input asp-for="Input.ConfirmPassword" class="form-control" />
                <span asp-validation-for="Input.ConfirmPassword" class="text-danger"></span>
            </div>
            <button type="submit" class="btn btn-primary">Register</button>
        </form>
    </div>
    <div class="col-md-6 col-md-offset-2">
        <section>
            <h4>Use another service to register.</h4>
            <hr />
            @{
                if ((Model.ExternalLogins?.Count ?? 0) == 0)
                {
                    <div>
                        <p>
                            External login feature is disabled when "ASPNETCORE_ENVIRONMENT" environment variable is not set to "Development". To enable this feature,
                            set the environment variable to "Development" and update appsettings.json or secrets.json with credentials specified in Program.cs.
                        </p>
                        <p>
                            Register as a new user or use these default credentials to login:
                        </p>
                        <ul>
                            <li>Email: admin@admin.com --- Password: Admin123!</li>
                            <li>Email: moderator@mod.com --- Password: Moderator123!</li>
                        </ul>
                        <p>
                            There are no external authentication services configured. See <a href="https://go.microsoft.com/fwlink/?LinkID=532715">this article</a>
                            for details on setting up this ASP.NET application to support logging in via external services.
                        </p>
                    </div>
                }
                else
                {
                    <form id="external-account" asp-page="./ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" method="post" class="form-horizontal">
                        <div>

                            @foreach (var provider in Model.ExternalLogins)
                            {
                                // <i class="fab fa-google"></i>
                                // <i class="fab fa-facebook"></i>
                                // <i class="fab fa-microsoft"></i>

                                if (@provider.Name == "Google")
                                {
                                    <p>
                                        <button type="submit" class="btn btn-link fab fa-google btn-lg" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">   @provider.DisplayName</button>
                                    </p>
                                }

                                else if (@provider.Name == "Facebook")
                                {
                                    <p>
                                        <button type="submit" class="btn btn-link fab fa-facebook btn-lg" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">   @provider.DisplayName</button>
                                    </p>
                                }

                                else if (@provider.Name == "Microsoft")
                                {
                                    <p>
                                        <button type="submit" class="btn btn-link fab fa-microsoft btn-lg" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">   @provider.DisplayName</button>
                                    </p>
                                }

                                else
                                {
                                    <p>
                                        <button type="submit" class="btn btn-link btn-lg" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">   @provider.DisplayName</button>
                                    </p>
                                }


                            }

                        </div>
                    </form>
                }
            }
        </section>
    </div>
</div>

@section Scripts {
    <partial name="_ValidationScriptsPartial" />
}
