PlotDirector/PlotLine/Views/Onboarding/ScanLocations.cshtml

130 lines
6.8 KiB
Plaintext

@model PlotLine.ViewModels.CoreImportBasicLocationReviewViewModel
@{
ViewData["Title"] = "Review Locations";
}
<section class="onboarding-shell">
<div class="onboarding-header">
<p class="eyebrow">Core import</p>
<h1>Review locations</h1>
<p class="lede">@Model.DocumentTitle - @Model.SelectedProjectName - @Model.SelectedBookTitle</p>
</div>
@if (TempData["OnboardingReviewMessage"] is string message)
{
<div class="alert alert-success">@message</div>
}
@if (TempData["ArchiveError"] is string error)
{
<div class="alert alert-danger">@error</div>
}
<div class="onboarding-panel">
<div class="review-summary-grid">
<div>
<span class="metric-label">Raw observations</span>
<strong>@Model.RawObservationCount</strong>
</div>
<div>
<span class="metric-label">Location candidates</span>
<strong>@Model.CandidateCount</strong>
</div>
</div>
<form asp-controller="Onboarding" asp-action="SaveBasicLocations" method="post">
@Html.AntiForgeryToken()
<input type="hidden" name="PreviewID" value="@Model.PreviewID" />
<div class="location-review-list">
@for (var i = 0; i < Model.Candidates.Count; i++)
{
var candidate = Model.Candidates[i];
<article class="location-review-row">
<input type="hidden" name="Locations[@i].StableKey" value="@candidate.StableKey" />
<div class="location-review-main">
<h2>@candidate.ProposedName</h2>
<p>@candidate.ObservationCount observation@(candidate.ObservationCount == 1 ? "" : "s") - first seen in Chapter @candidate.FirstChapterNumber, Scene @candidate.FirstSceneNumber</p>
@if (candidate.KnownNames.Count > 1)
{
<p>Known names: @string.Join(", ", candidate.KnownNames)</p>
}
<div class="location-evidence">
@foreach (var evidence in candidate.Evidence.Take(3))
{
<blockquote><strong>@evidence.Label:</strong> @evidence.EvidenceText</blockquote>
}
</div>
</div>
<div class="location-review-controls">
<label>
Decision
<select name="Locations[@i].Action">
<option value="Create" selected="@(candidate.Action == "Create" ? "selected" : null)">Create location</option>
<option value="SameLocation" selected="@(candidate.Action == "SameLocation" ? "selected" : null)">Same location as</option>
<option value="Ignore" selected="@(candidate.Action == "Ignore" ? "selected" : null)">Ignore</option>
</select>
</label>
<label>
Preferred name
<input type="text" name="Locations[@i].PreferredName" value="@candidate.PreferredName" maxlength="200" />
</label>
<label>
Parent location
<select name="Locations[@i].ParentLocationID">
<option value="">No canonical parent</option>
@foreach (var option in Model.ExistingLocationOptions)
{
<option value="@option.LocationID" selected="@(candidate.ParentLocationID == option.LocationID ? "selected" : null)">@option.Label</option>
}
</select>
</label>
<label>
Parent candidate
<select name="Locations[@i].ParentCandidateKey">
<option value="">No pending parent</option>
@foreach (var option in Model.Candidates.Where(item => item.StableKey != candidate.StableKey))
{
<option value="@option.StableKey" selected="@(candidate.ParentCandidateKey == option.StableKey ? "selected" : null)">@option.ProposedName</option>
}
</select>
</label>
<label>
Same location as existing
<select name="Locations[@i].SameAsLocationID">
<option value="">No existing location</option>
@foreach (var option in Model.ExistingLocationOptions)
{
<option value="@option.LocationID" selected="@(candidate.SameAsLocationID == option.LocationID ? "selected" : null)">@option.Label</option>
}
</select>
</label>
<label>
Same location as candidate
<select name="Locations[@i].SameAsCandidateKey">
<option value="">No pending candidate</option>
@foreach (var option in Model.Candidates.Where(item => item.StableKey != candidate.StableKey))
{
<option value="@option.StableKey" selected="@(candidate.SameAsCandidateKey == option.StableKey ? "selected" : null)">@option.ProposedName</option>
}
</select>
</label>
</div>
</article>
}
</div>
<div class="form-actions">
<button class="btn btn-secondary" type="submit" name="intent" value="save">Save choices</button>
<button class="btn btn-outline-secondary" type="submit" name="intent" value="skip">Skip locations</button>
<button class="btn btn-primary" type="submit" name="intent" value="continue">Save locations and review characters</button>
</div>
</form>
</div>
</section>