80 lines
3.2 KiB
Plaintext

@model FloorPlanListViewModel
@{
ViewData["Title"] = "Floor Plans";
ViewData["ProjectSection"] = "Floor Plans";
}
<nav class="breadcrumb-trail" aria-label="Breadcrumb">
<a asp-controller="Projects" asp-action="Index">Projects</a>
<a asp-controller="Projects" asp-action="Details" asp-route-id="@Model.Project.ProjectID">@Model.Project.ProjectName</a>
<span>Floor Plans</span>
</nav>
<partial name="_ProjectSectionNav" model="Model.Project" />
<div class="page-heading compact">
<div>
<p class="eyebrow">Location plans</p>
<h1>@Model.Project.ProjectName</h1>
</div>
</div>
@if (TempData["FloorPlanMessage"] is string message)
{
<div class="alert alert-success">@message</div>
}
<section class="edit-panel">
<h2>Create floor plan</h2>
<form asp-action="Create" method="post" class="row g-3">
<input asp-for="NewFloorPlan.ProjectID" type="hidden" name="ProjectID" />
<div class="col-md-5">
<label asp-for="NewFloorPlan.Name" class="form-label"></label>
<input asp-for="NewFloorPlan.Name" class="form-control" name="Name" />
</div>
<div class="col-md-5">
<label asp-for="NewFloorPlan.Description" class="form-label"></label>
<input asp-for="NewFloorPlan.Description" class="form-control" name="Description" />
</div>
<div class="col-md-2 d-flex align-items-end">
<button class="btn btn-primary w-100" type="submit">Create</button>
</div>
</form>
</section>
@if (!Model.FloorPlans.Any())
{
<section class="empty-panel">
<h2>No floor plans yet</h2>
<p>Create a plan, then arrange existing locations as rooms, corridors, halls, gardens, or other spaces.</p>
</section>
}
else
{
<section class="edit-panel">
<div class="floor-plan-list">
@foreach (var floorPlan in Model.FloorPlans)
{
<article class="floor-plan-list-item">
<div>
<h2><a asp-action="Edit" asp-route-id="@floorPlan.FloorPlanID">@floorPlan.Name</a></h2>
@if (!string.IsNullOrWhiteSpace(floorPlan.Description))
{
<p>@floorPlan.Description</p>
}
<p class="muted">@floorPlan.FloorCount floor(s), @floorPlan.BlockCount placed block(s)</p>
</div>
<div class="button-row compact-buttons">
<a class="btn btn-outline-secondary btn-sm" asp-action="Edit" asp-route-id="@floorPlan.FloorPlanID">Open editor</a>
<form asp-action="DeletePlan" method="post" data-confirm-message="Delete this floor plan?&#10;&#10;This deletes its floors and placed blocks. Linked locations are not deleted.">
<input type="hidden" name="id" value="@floorPlan.FloorPlanID" />
<input type="hidden" name="projectId" value="@Model.Project.ProjectID" />
<button class="btn btn-outline-danger btn-sm" type="submit">Delete</button>
</form>
</div>
</article>
}
</div>
</section>
}