Phase 9G Fixes
This commit is contained in:
parent
8f006874ac
commit
7fe5a7b9ac
@ -35,11 +35,11 @@ public sealed class WriterController(
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> EditWritingPlan(int id)
|
||||
public async Task<IActionResult> EditWritingPlan(int writingPlanId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var model = await writingSchedule.GetWritingPlanSettingsAsync(id);
|
||||
var model = await writingSchedule.GetWritingPlanSettingsAsync(writingPlanId);
|
||||
return View(model);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
@ -271,14 +271,14 @@ public sealed class WriterController(
|
||||
try
|
||||
{
|
||||
var items = await writingSchedule.RegenerateScheduleAsync(writingPlanId);
|
||||
TempData["SchedulePreviewMessage"] = $"{items.Count} item{(items.Count == 1 ? "" : "s")} generated.";
|
||||
TempData["WritingPlansMessage"] = $"{items.Count} item{(items.Count == 1 ? "" : "s")} generated.";
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
TempData["SchedulePreviewError"] = ex.Message;
|
||||
TempData["WritingPlansError"] = ex.Message;
|
||||
}
|
||||
|
||||
return RedirectToAction(nameof(SchedulePreview), new { writingPlanId });
|
||||
return RedirectToAction(nameof(WritingPlans));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
@ -7,15 +7,23 @@
|
||||
|
||||
<nav class="breadcrumb-trail" aria-label="Breadcrumb">
|
||||
<a asp-controller="Writer" asp-action="Index">Writer Workspace</a>
|
||||
<a asp-controller="Writer" asp-action="WritingPlans">Writing Plans</a>
|
||||
<span>Schedule Preview</span>
|
||||
</nav>
|
||||
|
||||
<div class="page-heading compact">
|
||||
<div>
|
||||
<p class="eyebrow">Validation</p>
|
||||
<p class="eyebrow">Schedule</p>
|
||||
<h1>Schedule Preview</h1>
|
||||
<p class="lead-text">Generated writing schedule items.</p>
|
||||
</div>
|
||||
<div class="button-row">
|
||||
<a class="btn btn-outline-secondary" asp-action="WritingPlans">Back to Writing Plans</a>
|
||||
@if (Model.SelectedPlan is not null)
|
||||
{
|
||||
<a class="btn btn-outline-primary" asp-action="EditWritingPlan" asp-route-writingPlanId="@Model.SelectedPlan.WritingPlanID">Edit Plan</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(message))
|
||||
@ -32,6 +40,7 @@
|
||||
{
|
||||
<section class="story-bible-section">
|
||||
<p class="muted">No writing plans found.</p>
|
||||
<a class="btn btn-primary" asp-action="ScheduleSetup">Create Writing Schedule</a>
|
||||
</section>
|
||||
}
|
||||
else
|
||||
@ -101,99 +110,6 @@ else
|
||||
<div class="alert alert-warning">Schedule requires attention.</div>
|
||||
}
|
||||
|
||||
<section class="story-bible-section">
|
||||
<div class="button-row">
|
||||
<form asp-action="GenerateSchedule" method="post">
|
||||
<input type="hidden" name="writingPlanId" value="@Model.SelectedPlan.WritingPlanID" />
|
||||
<button class="btn btn-primary" type="submit">Generate Schedule</button>
|
||||
</form>
|
||||
<button class="btn btn-outline-danger" type="button" data-bs-toggle="modal" data-bs-target="#deleteGeneratedScheduleModal">Delete Generated Schedule</button>
|
||||
@if (Model.SelectedPlanRequiresRebalance)
|
||||
{
|
||||
<a class="btn btn-outline-primary" asp-action="PreviewRebalance" asp-route-writingPlanId="@Model.SelectedPlan.WritingPlanID">Preview Rebalance</a>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="modal fade" id="deleteGeneratedScheduleModal" tabindex="-1" aria-labelledby="deleteGeneratedScheduleModalTitle" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2 class="modal-title fs-5" id="deleteGeneratedScheduleModalTitle">Delete generated schedule?</h2>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Delete generated schedule items for <strong>@Model.SelectedPlan.PlanName</strong>?</p>
|
||||
<p class="muted mb-0">This removes the generated schedule items for this plan. The writing plan itself will remain.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<form asp-action="DeleteGeneratedSchedule" method="post" class="m-0">
|
||||
<input type="hidden" name="writingPlanId" value="@Model.SelectedPlan.WritingPlanID" />
|
||||
<button class="btn btn-danger" type="submit">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (Model.RebalancePreview is not null)
|
||||
{
|
||||
<section class="story-bible-section">
|
||||
<div class="story-bible-section-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Rebalance</p>
|
||||
<h2>Rebalance Preview</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="story-bible-grid story-bible-grid-compact">
|
||||
<article class="story-bible-card"><h3>Current Finish Date</h3><strong class="writer-kpi">@(Model.RebalancePreview.OriginalFinishDate?.ToString("dd MMM yyyy") ?? "-")</strong></article>
|
||||
<article class="story-bible-card"><h3>Proposed Finish Date</h3><strong class="writer-kpi">@(Model.RebalancePreview.ProposedFinishDate?.ToString("dd MMM yyyy") ?? "-")</strong></article>
|
||||
<article class="story-bible-card"><h3>Tasks Affected</h3><strong class="writer-kpi">@Model.RebalancePreview.TasksAffected</strong></article>
|
||||
</div>
|
||||
|
||||
@if (!Model.RebalancePreview.Changes.Any())
|
||||
{
|
||||
<p class="muted">No planned tasks need new dates.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="table-responsive mt-3">
|
||||
<table class="table align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Task Type</th>
|
||||
<th>Scene</th>
|
||||
<th>Current Date</th>
|
||||
<th>Proposed Date</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var change in Model.RebalancePreview.Changes)
|
||||
{
|
||||
<tr>
|
||||
<td>@change.TaskType</td>
|
||||
<td>@change.SceneName</td>
|
||||
<td>@change.CurrentDate.ToString("dd MMM yyyy")</td>
|
||||
<td>@change.ProposedDate.ToString("dd MMM yyyy")</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="button-row mt-3">
|
||||
<form asp-action="ApplyRebalance" method="post">
|
||||
<input type="hidden" name="writingPlanId" value="@Model.RebalancePreview.WritingPlanID" />
|
||||
<button class="btn btn-primary" type="submit">Apply Rebalance</button>
|
||||
</form>
|
||||
<a class="btn btn-outline-secondary" asp-action="SchedulePreview" asp-route-writingPlanId="@Model.RebalancePreview.WritingPlanID">Cancel</a>
|
||||
</div>
|
||||
</section>
|
||||
}
|
||||
|
||||
<section class="story-bible-section">
|
||||
<div class="story-bible-section-heading">
|
||||
<div>
|
||||
|
||||
@ -81,7 +81,7 @@
|
||||
<td>
|
||||
<div class="button-row">
|
||||
<a class="btn btn-sm btn-outline-secondary" asp-action="SchedulePreview" asp-route-writingPlanId="@plan.WritingPlanID">View Schedule</a>
|
||||
<a class="btn btn-sm btn-outline-primary" asp-action="EditWritingPlan" asp-route-id="@plan.WritingPlanID">Edit Plan</a>
|
||||
<a class="btn btn-sm btn-outline-primary" asp-action="EditWritingPlan" asp-route-writingPlanId="@plan.WritingPlanID">Edit Plan</a>
|
||||
@if (plan.IsActive)
|
||||
{
|
||||
<form asp-action="DeactivateWritingPlan" method="post">
|
||||
@ -100,10 +100,7 @@
|
||||
<input type="hidden" name="writingPlanId" value="@plan.WritingPlanID" />
|
||||
<button class="btn btn-sm btn-outline-primary" type="submit">Regenerate Schedule</button>
|
||||
</form>
|
||||
<form asp-action="DeleteWritingPlan" method="post" onsubmit="return confirm('Delete this writing plan and its generated schedule items?');">
|
||||
<input type="hidden" name="writingPlanId" value="@plan.WritingPlanID" />
|
||||
<button class="btn btn-sm btn-outline-danger" type="submit">Delete Plan</button>
|
||||
</form>
|
||||
<button class="btn btn-sm btn-outline-danger" type="button" data-bs-toggle="modal" data-bs-target="#deleteWritingPlanModal-@plan.WritingPlanID">Delete Plan</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@ -111,5 +108,30 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@foreach (var plan in Model.Plans)
|
||||
{
|
||||
<div class="modal fade" id="deleteWritingPlanModal-@plan.WritingPlanID" tabindex="-1" aria-labelledby="deleteWritingPlanModalTitle-@plan.WritingPlanID" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2 class="modal-title fs-5" id="deleteWritingPlanModalTitle-@plan.WritingPlanID">Delete Writing Plan</h2>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Delete <strong>@plan.PlanName</strong>?</p>
|
||||
<p class="muted mb-0">The writing plan and its associated generated schedule items will be deleted. Scenes and chapters themselves will not be deleted.</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<form asp-action="DeleteWritingPlan" method="post" class="m-0" data-no-delete-confirm="true">
|
||||
<input type="hidden" name="writingPlanId" value="@plan.WritingPlanID" />
|
||||
<button class="btn btn-danger" type="submit">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</section>
|
||||
|
||||
@ -99,7 +99,12 @@
|
||||
|
||||
document.addEventListener("submit", (event) => {
|
||||
const form = event.target;
|
||||
if (!(form instanceof HTMLFormElement) || form.dataset.confirmed === "true" || form.dataset.confirmSkip === "true") {
|
||||
if (
|
||||
!(form instanceof HTMLFormElement)
|
||||
|| form.dataset.confirmed === "true"
|
||||
|| form.dataset.confirmSkip === "true"
|
||||
|| form.dataset.noDeleteConfirm === "true"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
2
PlotLine/wwwroot/js/site.min.js
vendored
2
PlotLine/wwwroot/js/site.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user