PlotDirector/PlotLine/Views/Locations/_LocationTree.cshtml

32 lines
2.4 KiB
Plaintext

@model LocationListViewModel
<section class="edit-panel location-tree" data-location-tree>
@if (TempData["GeographyMessage"] is string geographyMessage)
{
<p class="muted" role="status">@geographyMessage</p>
}
@foreach (var location in Model.Locations)
{
<div data-pd-context="location" data-pd-context-id="@location.LocationID" data-pd-context-label="@location.LocationName" class="location-tree-row" data-drag-type="location" data-drag-id="@location.LocationID" data-drag-label="@location.LocationName" data-parent-location-id="@location.ParentLocationID" data-parent-location-name="@location.ParentLocationName" style="--location-depth:@location.Depth">
<div>
<a asp-action="Details" asp-route-id="@location.LocationID"><strong>@location.LocationName</strong></a>
@if (!string.IsNullOrWhiteSpace(location.LocationTypeName))
{
<span class="location-badge">@location.LocationTypeName</span>
}
<span class="muted">@location.LocationPath</span>
</div>
<div class="button-row compact-buttons">
<a class="btn btn-outline-secondary btn-sm" asp-action="Edit" asp-route-id="@location.LocationID">Edit</a>
<form asp-action="Archive" method="post" data-confirm-message="Archive this location?&#10;&#10;This will hide it from active lists and timelines, but the data will be kept and can be restored later.">
<input type="hidden" name="id" value="@location.LocationID" />
<input type="hidden" name="projectId" value="@Model.Project.ProjectID" />
<button class="btn btn-outline-danger btn-sm" type="submit">Archive</button>
</form>
</div>
<span class="toolbar-drag-handle location-drag-handle" draggable="true" data-location-drag-handle
role="img" aria-label="Drag @location.LocationName. To change its parent without dragging, choose Edit."
title="Drag to change parent or create a relationship. Use Edit to change parent without dragging.">⠿</span>
</div>
}
</section>