@model LocationEditViewModel
@{
    ViewData["Title"] = Model.LocationID == 0 ? "New Location" : "Edit Location";
}

<div class="page-heading compact">
    <div>
        <p class="eyebrow">Location</p>
        <h1>@ViewData["Title"]</h1>
    </div>
</div>

<form asp-action="Save" method="post" class="edit-panel">
    <input asp-for="LocationID" type="hidden" />
    <input asp-for="ProjectID" type="hidden" />

    <div class="row g-3">
        <div class="col-md-8">
            <label asp-for="LocationName" class="form-label"></label>
            <input asp-for="LocationName" class="form-control" />
            <span asp-validation-for="LocationName" class="text-danger"></span>
        </div>
        <div class="col-md-4">
            <label asp-for="LocationTypeID" class="form-label"></label>
            <select asp-for="LocationTypeID" asp-items="Model.LocationTypeOptions" class="form-select">
                <option value="">Not set</option>
            </select>
        </div>
        <div class="col-12">
            <label asp-for="ParentLocationID" class="form-label"></label>
            <select asp-for="ParentLocationID" asp-items="Model.ParentLocationOptions" class="form-select">
                <option value="">Top level</option>
            </select>
        </div>
        <div class="col-12">
            <div class="form-check">
                <input asp-for="ShowInQuickAddBar" class="form-check-input" />
                <label asp-for="ShowInQuickAddBar" class="form-check-label"></label>
                <div class="form-text">Makes this item available as a draggable shortcut on the Timeline page.</div>
            </div>
        </div>
        <div class="col-12">
            <label asp-for="Description" class="form-label"></label>
            <textarea asp-for="Description" class="form-control" rows="5"></textarea>
        </div>
    </div>

    <div class="button-row mt-3">
        <button class="btn btn-primary" type="submit">Save location</button>
        <a class="btn btn-outline-secondary" asp-action="Index" asp-route-projectId="@Model.ProjectID">Cancel</a>
    </div>
</form>

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