238 lines
12 KiB
Plaintext
238 lines
12 KiB
Plaintext
@model WritingScheduleSetupViewModel
|
|
@{
|
|
ViewData["DesktopLayout"] = "wide";
|
|
ViewData["Title"] = "Create Writing Schedule";
|
|
}
|
|
|
|
<nav data-pwa-identity class="breadcrumb-trail" aria-label="Breadcrumb">
|
|
<a asp-controller="Writer" asp-action="Index" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Writer</a>
|
|
<span>Create Writing Schedule</span>
|
|
</nav>
|
|
|
|
<div data-pwa-task class="page-heading compact">
|
|
<div>
|
|
<p class="eyebrow">Writing schedule</p>
|
|
<h1>Create Writing Schedule <help-icon key="workspace.writingPlans" /></h1>
|
|
<p class="lead-text">Plan for the selected book, or choose All Books for a project-wide plan.</p><a asp-action="Index" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Skip scheduling · return to Writer</a>
|
|
</div>
|
|
</div>
|
|
|
|
<section class="story-bible-section">
|
|
<form asp-action="ScheduleSetup" method="post" class="story-bible-card chapter-goal-form pd-record-form">
|
|
<div asp-validation-summary="ModelOnly" class="alert alert-warning"></div>
|
|
|
|
<div class="row g-3">
|
|
<div class="col-md-6">
|
|
<label asp-for="PlanName" class="form-label">Plan Name</label>
|
|
<input asp-for="PlanName" class="form-control" />
|
|
<span asp-validation-for="PlanName" class="text-danger"></span>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label asp-for="GoalType" class="form-label">Type of work</label>
|
|
<select asp-for="GoalType" asp-items="Model.GoalTypeOptions" class="form-select"></select>
|
|
<span asp-validation-for="GoalType" class="text-danger"></span>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label asp-for="ProjectID" class="form-label">Project</label>
|
|
<select asp-for="ProjectID" asp-items="Model.ProjectOptions" class="form-select">
|
|
<option value="">Select project</option>
|
|
</select>
|
|
<span asp-validation-for="ProjectID" class="text-danger"></span>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label asp-for="BookID" class="form-label">Book</label>
|
|
<select asp-for="BookID" asp-items="Model.BookOptions" class="form-select">
|
|
<option value="">All Books</option>
|
|
</select>
|
|
<span asp-validation-for="BookID" class="text-danger"></span>
|
|
</div>
|
|
|
|
@if (Model.WorkingGroups.Count > 0 || Model.WorkingGroupID.HasValue)
|
|
{
|
|
<div class="col-md-6">
|
|
<label asp-for="WorkingGroupID" class="form-label">Work to schedule</label>
|
|
<select asp-for="WorkingGroupID" class="form-select">
|
|
<option value="">Choose individual chapters or scenes</option>
|
|
@foreach (var group in Model.WorkingGroups.Where(group => group.ChapterIDs.Count > 0))
|
|
{
|
|
<option value="@group.GroupID">@group.Name (@group.ChapterIDs.Count chapters)</option>
|
|
}
|
|
</select>
|
|
</div>
|
|
}
|
|
|
|
<div class="col-md-6">
|
|
<label asp-for="StartDate" class="form-label">Start Date</label>
|
|
<input asp-for="StartDate" class="form-control" type="date" data-author-start-date data-default-local="@(Context.Request.Method == "GET" ? "true" : "false")" />
|
|
<span asp-validation-for="StartDate" class="text-danger"></span>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<label asp-for="DeadlineDate" class="form-label">Target date</label>
|
|
<input asp-for="DeadlineDate" class="form-control" type="date" data-author-target-date data-default-local="@(Context.Request.Method == "GET" ? "true" : "false")" />
|
|
<span asp-validation-for="DeadlineDate" class="text-danger"></span>
|
|
</div>
|
|
|
|
<input type="hidden" asp-for="SessionLengthMinutes" />
|
|
|
|
<div class="col-md-6">
|
|
<label asp-for="ContingencyPercent" class="form-label">Reserve for contingency (%)</label>
|
|
<input asp-for="ContingencyPercent" class="form-control" min="1" max="99" />
|
|
<span asp-validation-for="ContingencyPercent" class="text-danger"></span>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<label asp-for="DraftingWordsPerHour" class="form-label">Drafting words per hour</label>
|
|
<input asp-for="DraftingWordsPerHour" class="form-control" min="1" />
|
|
<span asp-validation-for="DraftingWordsPerHour" class="text-danger"></span>
|
|
@if (Model.ObservedDraftingWordsPerHour is > 0)
|
|
{
|
|
<p>Observed pace from matched drafting sessions · @Model.ObservedDraftingWordsPerHour words per hour.</p>
|
|
<button class="btn btn-sm btn-outline-secondary" name="step" value="use-observed-rate" type="submit">Use observed rate and review work</button>
|
|
}
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<label class="form-label">Writing Availability</label>
|
|
<div class="table-responsive">
|
|
<table class="table align-middle">
|
|
<thead>
|
|
<tr>
|
|
<th>Day</th>
|
|
<th>Available</th>
|
|
<th>Session Length</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@for (var i = 0; i < Model.WritingDayAvailability.Count; i++)
|
|
{
|
|
<tr>
|
|
<td>
|
|
@Model.WritingDayAvailability[i].Day
|
|
<input type="hidden" asp-for="WritingDayAvailability[i].Day" />
|
|
</td>
|
|
<td>
|
|
<input asp-for="WritingDayAvailability[i].IsAvailable" />
|
|
</td>
|
|
<td>
|
|
<select asp-for="WritingDayAvailability[i].Minutes" asp-items="Model.SessionLengthOptions" class="form-select"></select>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<span asp-validation-for="WritingDayAvailability" class="text-danger"></span>
|
|
</div>
|
|
|
|
<div class="col-12 writer-checkbox-grid">
|
|
<label>
|
|
<input asp-for="IncludeBlockedScenes" />
|
|
Include Blocked Scenes
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
@if (Model.Candidates.Count > 0)
|
|
{
|
|
<h2 class="mt-4">Choose work and review effort</h2>
|
|
@if (Model.WorkingGroupID.HasValue)
|
|
{
|
|
<p>This schedule reserves time for the group. Choose any chapter in the group when you sit down to write.</p>
|
|
}
|
|
<p>Adjust each budget in minutes. Drafting estimates use the estimated words remaining and your drafting rate. Use your own budget for research, revision, editing, or work without a word estimate.</p>
|
|
<div class="table-responsive">
|
|
<table class="table align-middle">
|
|
<thead><tr><th>Include</th><th>Chapter / scene</th><th>Activity</th><th>Minutes</th></tr></thead>
|
|
<tbody>
|
|
@for (var i = 0; i < Model.Candidates.Count; i++)
|
|
{
|
|
var row = Model.Candidates[i];
|
|
<tr>
|
|
<td>
|
|
<input asp-for="Candidates[i].Selected" aria-label="Include @row.Title" />
|
|
<input asp-for="Candidates[i].GroupID" type="hidden" />
|
|
<input asp-for="Candidates[i].ChapterID" type="hidden" />
|
|
<input asp-for="Candidates[i].SceneID" type="hidden" />
|
|
</td>
|
|
<td>@row.BookTitle · @row.Title</td>
|
|
<td>
|
|
<select asp-for="Candidates[i].Kind" class="form-select" aria-label="Activity for @row.Title">
|
|
<option value="Draft">Draft</option>
|
|
<option value="Plan">Research / plan</option>
|
|
<option value="Edit">Revise / edit</option>
|
|
<option value="Review">Read / review</option>
|
|
</select>
|
|
</td>
|
|
<td><input asp-for="Candidates[i].Minutes" class="form-control" min="5" max="1440" aria-label="Minutes for @row.Title" /></td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
}
|
|
else if (Context.Request.Method == "POST" && ViewData.ModelState.IsValid)
|
|
{
|
|
<p class="mt-3">No eligible work was found. Choose a different book, add a chapter, or include blocked scenes.</p>
|
|
}
|
|
|
|
@if (Model.Capacity is { } capacity)
|
|
{
|
|
<section class="mt-4" aria-label="Schedule preview">
|
|
<h2>Schedule preview</h2>
|
|
<dl>
|
|
<dt>Available</dt><dd>@capacity.Available min</dd>
|
|
<dt>Reserved for contingency</dt><dd>@capacity.Reserved min</dd>
|
|
<dt>Usable</dt><dd>@capacity.Usable min</dd>
|
|
<dt>Required</dt><dd>@capacity.Required min</dd>
|
|
<dt>Shortfall</dt><dd>@capacity.Shortfall min</dd>
|
|
<dt>Forecast</dt><dd>@(capacity.Forecast?.ToString("d MMM yyyy") ?? "Unavailable")</dd>
|
|
</dl>
|
|
@if (Model.OverlapDates.Count > 0)
|
|
{
|
|
<p role="status">Other active plans also use @Model.OverlapDates.Count of these dates. Check your combined time before saving.</p>
|
|
}
|
|
@if (capacity.Shortfall > 0)
|
|
{
|
|
<p role="status">The selected work exceeds usable time. Change the work, availability, contingency, or target date and preview again.</p>
|
|
}
|
|
else if (capacity.Allocations.Count == 0)
|
|
{
|
|
<p role="status">Select at least one activity to preview a schedule.</p>
|
|
}
|
|
else
|
|
{
|
|
<ul>
|
|
@foreach (var day in capacity.Allocations.GroupBy(item => item.ScheduledDate))
|
|
{
|
|
<li>@day.Key.ToString("d MMM yyyy") · @day.Sum(item => item.Minutes) min · @string.Join(", ", day.Select(item => item.Title).Distinct())</li>
|
|
}
|
|
</ul>
|
|
}
|
|
</section>
|
|
}
|
|
|
|
<input type="hidden" asp-for="ReviewFingerprint" />
|
|
<input type="hidden" asp-for="CreationToken" />
|
|
<div class="button-row mt-3" data-pwa-context="Record" data-pwa-priority="0">
|
|
@if (Model.Capacity?.Allocations.Count > 0)
|
|
{
|
|
<button class="btn btn-primary" data-pwa-icon="save" type="submit" name="step" value="save">Save writing schedule</button>
|
|
}
|
|
@if (Model.Candidates.Count > 0)
|
|
{
|
|
<button class="btn @(Model.Capacity?.Allocations.Count > 0 ? "btn-outline-primary" : "btn-primary")" type="submit" name="step" value="preview">Preview schedule</button>
|
|
}
|
|
<button class="btn @(Model.Candidates.Count > 0 ? "btn-outline-secondary" : "btn-primary")" type="submit" name="step" value="review">Review activities</button>
|
|
<a class="btn btn-outline-secondary" asp-action="SchedulePreview" asp-route-projectId="@Model.ProjectID" asp-route-bookId="@Model.BookID">Cancel</a>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
|
|
@section Scripts {
|
|
<partial name="_ValidationScriptsPartial" />
|
|
<script src="~/js/writer-schedule-date.js" asp-append-version="true"></script>
|
|
}
|