@page "/city/{CityId:int}/pointofinterest/{PointOfInterestId:int}/edit"

@if (PointOfInterest == null)
{
    <Loading></Loading>
}
else
{
    <PageHeader Name="Point d'intéret" NameType="Modifier" LinkType="LinkType.Details" Link="@($"/city/{CityId}/pointofinterest/{PointOfInterestId}")"></PageHeader>
    @if (ReturnData)
    {
        <Card HeaderTitle="Modifier le point d'intéret">
            <div class="alert @StatusClass">@ReturnMessage</div>
        </Card>
    } else
    {
        <Card HeaderTitle="Modifier le point d'intéret">
            <EditForm Model="PointOfInterest" OnValidSubmit="HandleValidSubmit" OnInvalidSubmit="HandleInvalidSubmit">
                <div class="mb-3">
                    <label for="PointOfInterestName" class="form-label">Nom</label>

                    <div class="input-icon">
                        <span class="input-icon-addon">
                            <i class="fa-solid fa-location-dot"></i>
                        </span>
                        <InputText id="PointOfInterestName" @bind-Value="PointOfInterest.Name" class="form-control"></InputText>
                        <ValidationMessage class="offset-md-3 col-md-8 text-danger" For="@(() => PointOfInterest.Name)" />
                    </div>
                </div>
                <div class="mb-3">
                    <label for="PointOfInterestDescription" class="form-label">Description</label>
                    <div class="input-icon">
                        <span class="input-icon-addon">
                            <i class="fa-solid fa-align-left"></i>
                        </span>
                        <InputText id="PointOfInterestDescription" @bind-Value="PointOfInterest.Description" class="form-control"></InputText>
                        <ValidationMessage class="offset-md-3 col-md-8 text-danger" For="@(() => PointOfInterest.Description)" />
                    </div>
                </div>
                <div class="container d-flex mb-3 justify-content-end">
                    <a class="btn btn-danger" href="@($"/city/{CityId}/pointofinterest/{PointOfInterestId}")">Annuler</a>
                    <button type="submit" class="btn btn-success ms-1">Mettre à jour</button>
                </div>
            </EditForm>
        </Card>
    }
}